Repository navigation
Conversation
adrinjalali
left a comment
There was a problem hiding this comment.
@glemaitre this one I think it'd make sense to link from different classifiers. At the same time, it's a toy dataset, I'm not sure how relevant it is in real usecases.
| @@ -30,16 +32,39 @@ | |||
| from sklearn.metrics import accuracy_score | |||
| from sklearn.svm import SVC | |||
|
|
|||
There was a problem hiding this comment.
In modern examples, we move imports to the cell where they're first used instead of leaving them on the top of the example.
| # CLASSIFIER INITIALIZATION | ||
| # ------------------------------------------------------------- |
There was a problem hiding this comment.
| # CLASSIFIER INITIALIZATION | |
| # ------------------------------------------------------------- | |
| # Classifier Initialization | |
| # ------------------------- |
| #This classifier is not inherently designed for multiclass classification. As a consequence, | ||
| #it faces more challenges in distinguishing between class 2 and class 3 compared to the other estimators. | ||
| #-Linear Support Vector Classifier (SVC) with C as the regularization parameter | ||
| #and probability set to True for obtaining classification probabilities. | ||
| #-Gaussian Process Classifier (GPC) using the specified Gaussian Radial Basis Function (RBF) kernel. |
There was a problem hiding this comment.
some lines here are too long.
There was a problem hiding this comment.
You also need to have a space after the # character and make sure that a return the line is actually well aligned such as:
# - first item
# - second item split on several
# lines
# - third item| plt.colorbar(imshow_handle, cax=ax, orientation="horizontal") | ||
|
|
||
| # Show the plot | ||
| plt.show() |
There was a problem hiding this comment.
would be nice to have a conclusion as well if it makes sense.
There was a problem hiding this comment.
This is probably here we should mention if a classifier has difficulty distinguishing between 2 classes.
| # Load Iris dataset | ||
| # ------------------------- |
There was a problem hiding this comment.
| # Load Iris dataset | |
| # ------------------------- | |
| # Load Iris dataset | |
| # ----------------- |
| # Load Iris dataset | ||
| # ------------------------- | ||
| # First, we load the Iris data as a pandas dataframe. | ||
| iris = datasets.load_iris() |
There was a problem hiding this comment.
| iris = datasets.load_iris() | |
| iris = datasets.load_iris(as_frame=True) |
| iris = datasets.load_iris() | ||
| X = iris.data[:, 0:2] # we only take the first two features for visualization | ||
| # We only take the first two features for visualization. | ||
| X = iris.data[:, 0:2] |
There was a problem hiding this comment.
| X = iris.data[:, 0:2] | |
| X = iris.data[["sepal length (cm)", "sepal width (cm)"]] |
There was a problem hiding this comment.
Let's use a dataframe, it is more explicit on what is happening I find.
| #This classifier is not inherently designed for multiclass classification. As a consequence, | ||
| #it faces more challenges in distinguishing between class 2 and class 3 compared to the other estimators. | ||
| #-Linear Support Vector Classifier (SVC) with C as the regularization parameter | ||
| #and probability set to True for obtaining classification probabilities. | ||
| #-Gaussian Process Classifier (GPC) using the specified Gaussian Radial Basis Function (RBF) kernel. |
There was a problem hiding this comment.
You also need to have a space after the # character and make sure that a return the line is actually well aligned such as:
# - first item
# - second item split on several
# lines
# - third item| # Plot classification probabilities for each classifier | ||
| # ----------------------------------------------------------- |
There was a problem hiding this comment.
| # Plot classification probabilities for each classifier | |
| # ----------------------------------------------------------- | |
| # Plot classification probabilities for each classifier | |
| # ----------------------------------------------------- |
| plt.subplot(n_classifiers, n_classes, index * n_classes + k + 1) | ||
| plt.title("Class %d" % k) | ||
|
|
||
| # Add ylabel to the leftmost subplots |
| plt.xticks(()) | ||
| plt.yticks(()) | ||
|
|
||
| # Mark the actual data points on the plot if they belong to the current class |
There was a problem hiding this comment.
| # Mark the actual data points on the plot if they belong to the current class | |
| # For each class, plot the data point corresponding to the class |
| if idx.any(): | ||
| plt.scatter(X[idx, 0], X[idx, 1], marker="o", c="w", edgecolor="k") | ||
|
|
||
| # Create a color bar for the probability values |
| plt.title("Probability") | ||
| plt.colorbar(imshow_handle, cax=ax, orientation="horizontal") | ||
|
|
||
| # Show the plot |
| plt.colorbar(imshow_handle, cax=ax, orientation="horizontal") | ||
|
|
||
| # Show the plot | ||
| plt.show() |
There was a problem hiding this comment.
This is probably here we should mention if a classifier has difficulty distinguishing between 2 classes.
|
@paularilo Do you wish to address the reviews raised by @adrinjalali and myself such that we can merge this PR? |
|
Hi @adrinjalali and @glemaitre, I would be more than happy to provide help on this PR. May I work on it and adress your comments? |
|
@lebaudantoine Since this PR is currently stalled, feel free to take over. You can include the changes proposed in the changes proposed during the review process and open a new PR that supersedes this PR. |
|
thx @glemaitre will do ! |
|
Closing as stalled. |
Reference Issues/PRs
Towards #26927
What does this implement/fix? Explain your changes.
Commented the function in detail
Any other comments?
cc @adrinjalali @glemaitre