-
-
Notifications
You must be signed in to change notification settings - Fork 26k
DOC Update plot_permutation_test_for_classification.py #17385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @lucyleeow !
# | ||
# Next, we calculate the | ||
# :func:`~sklearn.model_selection.permutation_test_score` using the original | ||
# iris dataset, which has strong structure, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe:
# iris dataset, which has strong structure, and | |
# iris dataset, which strongly predict the labels, and |
# iris dataset, which has strong structure, and | ||
# the randomly generated features and iris labels, which should have | ||
# no dependency between features and labels. The | ||
# :class:`~sklearn.svm.svc` classifier and :ref:`accuracy_score` are used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# :class:`~sklearn.svm.svc` classifier and :ref:`accuracy_score` are used. | |
# :class:`~sklearn.svm.SVC` classifier and :ref:`accuracy_score` are used. |
# distribution by calculating the accuracy of the classifier | ||
# on 1000 different permutations of the dataset, where features | ||
# remain the same but labels undergo different permutations. This is the | ||
# distribution for the null hypothesis that there is no dependency between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# distribution for the null hypothesis that there is no dependency between | |
# distribution for the null hypothesis which states there is no dependency between |
plt.legend() | ||
plt.xlabel('Score') | ||
score_iris, perm_scores_iris, pvalue_iris = permutation_test_score( | ||
clf, X, y, scoring="accuracy", cv=cv, n_permutations=1000, n_jobs=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default is 1:
clf, X, y, scoring="accuracy", cv=cv, n_permutations=1000, n_jobs=1) | |
clf, X, y, scoring="accuracy", cv=cv, n_permutations=1000) |
clf, X, y, scoring="accuracy", cv=cv, n_permutations=1000, n_jobs=1) | ||
|
||
score_rand, perm_scores_rand, pvalue_rand = permutation_test_score( | ||
clf, X_rand, y, scoring="accuracy", cv=cv, n_permutations=1000, n_jobs=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clf, X_rand, y, scoring="accuracy", cv=cv, n_permutations=1000, n_jobs=1) | |
clf, X_rand, y, scoring="accuracy", cv=cv, n_permutations=1000) |
Thanks for the review @thomasjpfan! Amended. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. Just little improvements to be considered.
examples/feature_selection/plot_permutation_test_for_classification.py
Outdated
Show resolved
Hide resolved
examples/feature_selection/plot_permutation_test_for_classification.py
Outdated
Show resolved
Hide resolved
examples/feature_selection/plot_permutation_test_for_classification.py
Outdated
Show resolved
Hide resolved
examples/feature_selection/plot_permutation_test_for_classification.py
Outdated
Show resolved
Hide resolved
examples/feature_selection/plot_permutation_test_for_classification.py
Outdated
Show resolved
Hide resolved
examples/feature_selection/plot_permutation_test_for_classification.py
Outdated
Show resolved
Hide resolved
examples/feature_selection/plot_permutation_test_for_classification.py
Outdated
Show resolved
Hide resolved
examples/feature_selection/plot_permutation_test_for_classification.py
Outdated
Show resolved
Hide resolved
examples/feature_selection/plot_permutation_test_for_classification.py
Outdated
Show resolved
Hide resolved
Thanks @glemaitre! Just let me know what you think we should do to avoid the text output from matplotlib: #17385 (comment) |
ping @glemaitre, changes made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Reference Issues/PRs
What does this implement/fix? Explain your changes.
Any other comments?