Skip to content

Commit d9cdef4

Browse files
committed
Pushing the docs to dev/ for branch: master, commit 8ebb9a90776a2eb6707beebc7eb42af3cc627ce9
1 parent 1f3ddea commit d9cdef4

File tree

1,013 files changed

+3012
-3009
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,013 files changed

+3012
-3009
lines changed
20 Bytes
Binary file not shown.
19 Bytes
Binary file not shown.

dev/_downloads/plot_regression.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"print(__doc__)\n\n# Author: Alexandre Gramfort <[email protected]>\n# Fabian Pedregosa <[email protected]>\n#\n# License: BSD 3 clause (C) INRIA\n\n\n# #############################################################################\n# Generate sample data\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn import neighbors\n\nnp.random.seed(0)\nX = np.sort(5 * np.random.rand(40, 1), axis=0)\nT = np.linspace(0, 5, 500)[:, np.newaxis]\ny = np.sin(X).ravel()\n\n# Add noise to targets\ny[::5] += 1 * (0.5 - np.random.rand(8))\n\n# #############################################################################\n# Fit regression model\nn_neighbors = 5\n\nfor i, weights in enumerate(['uniform', 'distance']):\n knn = neighbors.KNeighborsRegressor(n_neighbors, weights=weights)\n y_ = knn.fit(X, y).predict(T)\n\n plt.subplot(2, 1, i + 1)\n plt.scatter(X, y, c='k', label='data')\n plt.plot(T, y_, c='g', label='prediction')\n plt.axis('tight')\n plt.legend()\n plt.title(\"KNeighborsRegressor (k = %i, weights = '%s')\" % (n_neighbors,\n weights))\n\nplt.show()"
29+
"print(__doc__)\n\n# Author: Alexandre Gramfort <[email protected]>\n# Fabian Pedregosa <[email protected]>\n#\n# License: BSD 3 clause (C) INRIA\n\n\n# #############################################################################\n# Generate sample data\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn import neighbors\n\nnp.random.seed(0)\nX = np.sort(5 * np.random.rand(40, 1), axis=0)\nT = np.linspace(0, 5, 500)[:, np.newaxis]\ny = np.sin(X).ravel()\n\n# Add noise to targets\ny[::5] += 1 * (0.5 - np.random.rand(8))\n\n# #############################################################################\n# Fit regression model\nn_neighbors = 5\n\nfor i, weights in enumerate(['uniform', 'distance']):\n knn = neighbors.KNeighborsRegressor(n_neighbors, weights=weights)\n y_ = knn.fit(X, y).predict(T)\n\n plt.subplot(2, 1, i + 1)\n plt.scatter(X, y, c='k', label='data')\n plt.plot(T, y_, c='g', label='prediction')\n plt.axis('tight')\n plt.legend()\n plt.title(\"KNeighborsRegressor (k = %i, weights = '%s')\" % (n_neighbors,\n weights))\n\nplt.tight_layout()\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/plot_regression.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@
4646
plt.title("KNeighborsRegressor (k = %i, weights = '%s')" % (n_neighbors,
4747
weights))
4848

49+
plt.tight_layout()
4950
plt.show()

dev/_downloads/scikit-learn-docs.pdf

-2.54 KB
Binary file not shown.

0 commit comments

Comments
 (0)