Skip to content

Commit 8a66083

Browse files
committed
Pushing the docs to dev/ for branch: master, commit 549514e4fdc59d925746b5dc9bd9383781923726
1 parent 19762de commit 8a66083

File tree

1,219 files changed

+3675
-3675
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,219 files changed

+3675
-3675
lines changed
Binary file not shown.

dev/_downloads/51e6f272e94e3b63cfd48c4b41fbaa10/plot_feature_selection_pipeline.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-
"from sklearn import svm\nfrom sklearn.datasets import make_classification\nfrom sklearn.feature_selection import SelectKBest, f_regression\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import classification_report\n\nprint(__doc__)\n\n# import some data to play with\nX, y = make_classification(\n n_features=20, n_informative=3, n_redundant=0, n_classes=4,\n n_clusters_per_class=2)\n\nX_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)\n\n# ANOVA SVM-C\n# 1) anova filter, take 3 best ranked features\nanova_filter = SelectKBest(f_regression, k=3)\n# 2) svm\nclf = svm.LinearSVC()\n\nanova_svm = make_pipeline(anova_filter, clf)\nanova_svm.fit(X_train, y_train)\ny_pred = anova_svm.predict(X_test)\nprint(classification_report(y_test, y_pred))\n\ncoef = anova_svm[:-1].inverse_transform(anova_svm['linearsvc'].coef_)\nprint(coef)"
29+
"from sklearn import svm\nfrom sklearn.datasets import make_classification\nfrom sklearn.feature_selection import SelectKBest, f_classif\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import classification_report\n\nprint(__doc__)\n\n# import some data to play with\nX, y = make_classification(\n n_features=20, n_informative=3, n_redundant=0, n_classes=4,\n n_clusters_per_class=2)\n\nX_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)\n\n# ANOVA SVM-C\n# 1) anova filter, take 3 best ranked features\nanova_filter = SelectKBest(f_classif, k=3)\n# 2) svm\nclf = svm.LinearSVC()\n\nanova_svm = make_pipeline(anova_filter, clf)\nanova_svm.fit(X_train, y_train)\ny_pred = anova_svm.predict(X_test)\nprint(classification_report(y_test, y_pred))\n\ncoef = anova_svm[:-1].inverse_transform(anova_svm['linearsvc'].coef_)\nprint(coef)"
3030
]
3131
}
3232
],

dev/_downloads/5a7e586367163444711012a4c5214817/plot_feature_selection_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212
from sklearn import svm
1313
from sklearn.datasets import make_classification
14-
from sklearn.feature_selection import SelectKBest, f_regression
14+
from sklearn.feature_selection import SelectKBest, f_classif
1515
from sklearn.pipeline import make_pipeline
1616
from sklearn.model_selection import train_test_split
1717
from sklearn.metrics import classification_report
@@ -27,7 +27,7 @@
2727

2828
# ANOVA SVM-C
2929
# 1) anova filter, take 3 best ranked features
30-
anova_filter = SelectKBest(f_regression, k=3)
30+
anova_filter = SelectKBest(f_classif, k=3)
3131
# 2) svm
3232
clf = svm.LinearSVC()
3333

Binary file not shown.

dev/_downloads/scikit-learn-docs.pdf

-29.4 KB
Binary file not shown.

dev/_images/iris.png

0 Bytes

0 commit comments

Comments
 (0)