Skip to content

Commit 6d9ac83

Browse files
committed
Pushing the docs to dev/ for branch: master, commit a2d361bf40dbe7eee77a8c27aba779358ff96d0e
1 parent 58fa32d commit 6d9ac83

File tree

1,208 files changed

+3746
-3749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,208 files changed

+3746
-3749
lines changed
Binary file not shown.

dev/_downloads/a9a92784a7617f5a14aa93d32f95dff7/plot_voting_regressor.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"cell_type": "markdown",
1616
"metadata": {},
1717
"source": [
18-
"\n# Plot individual and voting regression predictions\n\n\n.. currentmodule:: sklearn\n\nA voting regressor is an ensemble meta-estimator that fits base regressors each\non the whole dataset. It, then, averages the individual predictions to form a\nfinal prediction.\nWe will use three different regressors to predict the data:\n:class:`~ensemble.GradientBoostingRegressor`,\n:class:`~ensemble.RandomForestRegressor`, and\n:class:`~linear_model.LinearRegression`).\nThen, using them we will make voting regressor\n:class:`~ensemble.VotingRegressor`.\n\nFinally, we will plot all of them for comparison.\n\nWe will work with the diabetes dataset which consists of the 10 features\ncollected from a cohort of diabetes patients. The target is the disease\nprogression after one year from the baseline.\n"
18+
"\n# Plot individual and voting regression predictions\n\n\n.. currentmodule:: sklearn\n\nA voting regressor is an ensemble meta-estimator that fits several base\nregressors, each on the whole dataset. Then it averages the individual\npredictions to form a final prediction.\nWe will use three different regressors to predict the data:\n:class:`~ensemble.GradientBoostingRegressor`,\n:class:`~ensemble.RandomForestRegressor`, and\n:class:`~linear_model.LinearRegression`).\nThen the above 3 regressors will be used for the\n:class:`~ensemble.VotingRegressor`.\n\nFinally, we will plot the predictions made by all models for comparison.\n\nWe will work with the diabetes dataset which consists of 10 features\ncollected from a cohort of diabetes patients. The target is a quantitative\nmeasure of disease progression one year after baseline.\n"
1919
]
2020
},
2121
{
@@ -26,14 +26,14 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"print(__doc__)\n\nimport matplotlib.pyplot as plt\n\nfrom sklearn import datasets\nfrom sklearn.ensemble import GradientBoostingRegressor\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.ensemble import VotingRegressor"
29+
"print(__doc__)\n\nimport matplotlib.pyplot as plt\n\nfrom sklearn.datasets import load_diabetes\nfrom sklearn.ensemble import GradientBoostingRegressor\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.ensemble import VotingRegressor"
3030
]
3131
},
3232
{
3333
"cell_type": "markdown",
3434
"metadata": {},
3535
"source": [
36-
"Training classifiers\n--------------------------------\n\nFirst, we are going to load diabetes dataset and initiate gradient boosting\nregressor, random forest regressor and linear regression. Next, we are going\nto use each of them to build the voting regressor:\n\n"
36+
"Training classifiers\n--------------------------------\n\nFirst, we will load the diabetes dataset and initiate a gradient boosting\nregressor, a random forest regressor and a linear regression. Next, we will\nuse the 3 regressors to build the voting regressor:\n\n"
3737
]
3838
},
3939
{
@@ -44,14 +44,14 @@
4444
},
4545
"outputs": [],
4646
"source": [
47-
"X, y = datasets.load_diabetes(return_X_y=True)\n\n# Train classifiers\nreg1 = GradientBoostingRegressor(random_state=1)\nreg2 = RandomForestRegressor(random_state=1)\nreg3 = LinearRegression()\n\nreg1.fit(X, y)\nreg2.fit(X, y)\nreg3.fit(X, y)\n\nereg = VotingRegressor([('gb', reg1), ('rf', reg2), ('lr', reg3)])\nereg.fit(X, y)"
47+
"X, y = load_diabetes(return_X_y=True)\n\n# Train classifiers\nreg1 = GradientBoostingRegressor(random_state=1)\nreg2 = RandomForestRegressor(random_state=1)\nreg3 = LinearRegression()\n\nreg1.fit(X, y)\nreg2.fit(X, y)\nreg3.fit(X, y)\n\nereg = VotingRegressor([('gb', reg1), ('rf', reg2), ('lr', reg3)])\nereg.fit(X, y)"
4848
]
4949
},
5050
{
5151
"cell_type": "markdown",
5252
"metadata": {},
5353
"source": [
54-
"Making predictions\n--------------------------------\n\nNow we will use each of the regressors to make 20 first predictions about the\ndiabetes dataset.\n\n"
54+
"Making predictions\n--------------------------------\n\nNow we will use each of the regressors to make the 20 first predictions.\n\n"
5555
]
5656
},
5757
{
@@ -69,7 +69,7 @@
6969
"cell_type": "markdown",
7070
"metadata": {},
7171
"source": [
72-
"Plot the results\n--------------------------------\n\nFinally, we will visualize the 20 predictions. The red stars show the average\nprediction\n\n"
72+
"Plot the results\n--------------------------------\n\nFinally, we will visualize the 20 predictions. The red stars show the average\nprediction made by :class:`~ensemble.VotingRegressor`.\n\n"
7373
]
7474
},
7575
{

dev/_downloads/acb1430b51f399d6660add7428cadb67/plot_voting_regressor.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
66
.. currentmodule:: sklearn
77
8-
A voting regressor is an ensemble meta-estimator that fits base regressors each
9-
on the whole dataset. It, then, averages the individual predictions to form a
10-
final prediction.
8+
A voting regressor is an ensemble meta-estimator that fits several base
9+
regressors, each on the whole dataset. Then it averages the individual
10+
predictions to form a final prediction.
1111
We will use three different regressors to predict the data:
1212
:class:`~ensemble.GradientBoostingRegressor`,
1313
:class:`~ensemble.RandomForestRegressor`, and
1414
:class:`~linear_model.LinearRegression`).
15-
Then, using them we will make voting regressor
15+
Then the above 3 regressors will be used for the
1616
:class:`~ensemble.VotingRegressor`.
1717
18-
Finally, we will plot all of them for comparison.
18+
Finally, we will plot the predictions made by all models for comparison.
1919
20-
We will work with the diabetes dataset which consists of the 10 features
21-
collected from a cohort of diabetes patients. The target is the disease
22-
progression after one year from the baseline.
20+
We will work with the diabetes dataset which consists of 10 features
21+
collected from a cohort of diabetes patients. The target is a quantitative
22+
measure of disease progression one year after baseline.
2323
2424
"""
2525
print(__doc__)
2626

2727
import matplotlib.pyplot as plt
2828

29-
from sklearn import datasets
29+
from sklearn.datasets import load_diabetes
3030
from sklearn.ensemble import GradientBoostingRegressor
3131
from sklearn.ensemble import RandomForestRegressor
3232
from sklearn.linear_model import LinearRegression
@@ -36,11 +36,11 @@
3636
# Training classifiers
3737
# --------------------------------
3838
#
39-
# First, we are going to load diabetes dataset and initiate gradient boosting
40-
# regressor, random forest regressor and linear regression. Next, we are going
41-
# to use each of them to build the voting regressor:
39+
# First, we will load the diabetes dataset and initiate a gradient boosting
40+
# regressor, a random forest regressor and a linear regression. Next, we will
41+
# use the 3 regressors to build the voting regressor:
4242

43-
X, y = datasets.load_diabetes(return_X_y=True)
43+
X, y = load_diabetes(return_X_y=True)
4444

4545
# Train classifiers
4646
reg1 = GradientBoostingRegressor(random_state=1)
@@ -58,8 +58,7 @@
5858
# Making predictions
5959
# --------------------------------
6060
#
61-
# Now we will use each of the regressors to make 20 first predictions about the
62-
# diabetes dataset.
61+
# Now we will use each of the regressors to make the 20 first predictions.
6362

6463
xt = X[:20]
6564

@@ -73,7 +72,7 @@
7372
# --------------------------------
7473
#
7574
# Finally, we will visualize the 20 predictions. The red stars show the average
76-
# prediction
75+
# prediction made by :class:`~ensemble.VotingRegressor`.
7776

7877
plt.figure()
7978
plt.plot(pred1, 'gd', label='GradientBoostingRegressor')
Binary file not shown.

dev/_downloads/scikit-learn-docs.pdf

-28.3 KB
Binary file not shown.

dev/_images/iris.png

0 Bytes
-93 Bytes
-93 Bytes
-598 Bytes
-598 Bytes

0 commit comments

Comments
 (0)