WIP Add module on dimensionality reduction#876
Conversation
Co-authored-by: Frits Hermans <post@fritshermans.nl>
e8b649d to
d849a72
Compare
| # %% [markdown] | ||
| # ## Finding the principal component | ||
| # | ||
| # PCA is intended to find new features (called principal components, or "PC") |
There was a problem hiding this comment.
I think it would help to clarify the vocabulary and describe each of the objects we are talking about, giving for each of them its shape and its different names (eg V^T is the components_ attribute, called principal axes, of shape n_components x n_input_features, the output of transform() is XV, ...) otherwise it can be easy to get confused about what is what. when talking about directions it can be helpful to say in which space.
I realize there is a tension between this and keeping the explanation short and at a high-level for now, but I think it would help to fix a bit ideas and would not hesitate to repeat the sizes of the things we are talking about
SebastienMelo
left a comment
There was a problem hiding this comment.
Here are the few comments we discussed, thank you @ArturoAmorQ !
|
|
||
| # %% | ||
| pca_std = np.sqrt(pca.explained_variance_) | ||
| print(f"Std along the first PC : {pca_std[0]:.3f} mm") |
There was a problem hiding this comment.
I find it weird to give the unit here since PCA can mix units. Maybe add a comment like "in the general case the std along a PC has no unit because they can mix several heterogeneous units".
| labels = { | ||
| "mean_fit_time": "CV fit time (s)", | ||
| "mean_test_error": "CV score (MAE)", | ||
| } | ||
| grid_search_results["n_components"] = grid_search_results[ | ||
| "n_components" | ||
| ].fillna("None") | ||
| fig = px.scatter( | ||
| grid_search_results, | ||
| x="mean_fit_time", | ||
| y="mean_test_error", | ||
| error_x="std_fit_time", | ||
| error_y="std_test_score", | ||
| hover_data=grid_search_results.columns, | ||
| labels=labels, | ||
| ) | ||
| fig.update_layout( | ||
| title={ | ||
| "text": "Trade-off between fit time and mean test score", | ||
| "y": 0.95, | ||
| "x": 0.5, | ||
| "xanchor": "center", | ||
| "yanchor": "top", | ||
| } | ||
| ) | ||
| fig.show(renderer="notebook") |
There was a problem hiding this comment.
Define as a function that the student will copy paste to prevent the apparition of errors in the notbook
Co-authored-by: Franck Charras <franck.charras@libertymail.net> Co-authored-by: SebastienMelo <125986598+SebastienMelo@users.noreply.github.com>
Co-authored-by: SebastienMelo <125986598+SebastienMelo@users.noreply.github.com>
SebastienMelo
left a comment
There was a problem hiding this comment.
Everything seems good to me!
Adds module on PCA. Adds the wiki_news dataset, notebooks and exercises.
Probably a good idea to merge this after the clustering module in #836.
Note: This is still WIP. We are missing at least one quiz and the wrap-up quiz.