Skip to content

Commit 44b6484

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 398a7d3f4f008ff9f807ce425567c94947aba02c
1 parent f342d54 commit 44b6484

File tree

1,210 files changed

+3923
-3926
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,210 files changed

+3923
-3926
lines changed
Binary file not shown.

dev/_downloads/592b2521e44501266ca5339d1fb123cb/plot_rfe_with_cross_validation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
# Create the RFE object and compute a cross-validated score.
2323
svc = SVC(kernel="linear")
24-
# The "accuracy" scoring is proportional to the number of correct
25-
# classifications
24+
# The "accuracy" scoring shows the proportion of correct classifications
2625

2726
min_features_to_select = 1 # Minimum number of features to consider
2827
rfecv = RFECV(estimator=svc, step=1, cv=StratifiedKFold(2),
@@ -35,7 +34,7 @@
3534
# Plot number of features VS. cross-validation scores
3635
plt.figure()
3736
plt.xlabel("Number of features selected")
38-
plt.ylabel("Cross validation score (nb of correct classifications)")
37+
plt.ylabel("Cross validation score (accuracy)")
3938
plt.plot(range(min_features_to_select,
4039
len(rfecv.grid_scores_) + min_features_to_select),
4140
rfecv.grid_scores_)
Binary file not shown.

dev/_downloads/949ed208b2147ed2b3e348e81fef52be/plot_rfe_with_cross_validation.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\nimport matplotlib.pyplot as plt\nfrom sklearn.svm import SVC\nfrom sklearn.model_selection import StratifiedKFold\nfrom sklearn.feature_selection import RFECV\nfrom sklearn.datasets import make_classification\n\n# Build a classification task using 3 informative features\nX, y = make_classification(n_samples=1000, n_features=25, n_informative=3,\n n_redundant=2, n_repeated=0, n_classes=8,\n n_clusters_per_class=1, random_state=0)\n\n# Create the RFE object and compute a cross-validated score.\nsvc = SVC(kernel=\"linear\")\n# The \"accuracy\" scoring is proportional to the number of correct\n# classifications\n\nmin_features_to_select = 1 # Minimum number of features to consider\nrfecv = RFECV(estimator=svc, step=1, cv=StratifiedKFold(2),\n scoring='accuracy',\n min_features_to_select=min_features_to_select)\nrfecv.fit(X, y)\n\nprint(\"Optimal number of features : %d\" % rfecv.n_features_)\n\n# Plot number of features VS. cross-validation scores\nplt.figure()\nplt.xlabel(\"Number of features selected\")\nplt.ylabel(\"Cross validation score (nb of correct classifications)\")\nplt.plot(range(min_features_to_select,\n len(rfecv.grid_scores_) + min_features_to_select),\n rfecv.grid_scores_)\nplt.show()"
29+
"print(__doc__)\n\nimport matplotlib.pyplot as plt\nfrom sklearn.svm import SVC\nfrom sklearn.model_selection import StratifiedKFold\nfrom sklearn.feature_selection import RFECV\nfrom sklearn.datasets import make_classification\n\n# Build a classification task using 3 informative features\nX, y = make_classification(n_samples=1000, n_features=25, n_informative=3,\n n_redundant=2, n_repeated=0, n_classes=8,\n n_clusters_per_class=1, random_state=0)\n\n# Create the RFE object and compute a cross-validated score.\nsvc = SVC(kernel=\"linear\")\n# The \"accuracy\" scoring shows the proportion of correct classifications\n\nmin_features_to_select = 1 # Minimum number of features to consider\nrfecv = RFECV(estimator=svc, step=1, cv=StratifiedKFold(2),\n scoring='accuracy',\n min_features_to_select=min_features_to_select)\nrfecv.fit(X, y)\n\nprint(\"Optimal number of features : %d\" % rfecv.n_features_)\n\n# Plot number of features VS. cross-validation scores\nplt.figure()\nplt.xlabel(\"Number of features selected\")\nplt.ylabel(\"Cross validation score (accuracy)\")\nplt.plot(range(min_features_to_select,\n len(rfecv.grid_scores_) + min_features_to_select),\n rfecv.grid_scores_)\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/scikit-learn-docs.zip

-28.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)