Skip to content

FutureWarnings in the documentation #24876

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

Closed
25 tasks done
ArturoAmorQ opened this issue Nov 9, 2022 · 21 comments
Closed
25 tasks done

FutureWarnings in the documentation #24876

ArturoAmorQ opened this issue Nov 9, 2022 · 21 comments
Labels
Documentation good first issue Easy with clear instructions to resolve Meta-issue General issue associated to an identified list of tasks

Comments

@ArturoAmorQ
Copy link
Member

ArturoAmorQ commented Nov 9, 2022

Describe the issue linked to the documentation

Some FutureWarnings are present in the dev documentation and need to be fixed.
Here is a list:

Contributors willing to address this issue, please offer one example per pull request.

Thanks for your help!

Suggest a potential alternative/fix

No response

@ArturoAmorQ ArturoAmorQ added Documentation good first issue Easy with clear instructions to resolve Meta-issue General issue associated to an identified list of tasks labels Nov 9, 2022
@Ti-Ion
Copy link
Contributor

Ti-Ion commented Nov 10, 2022

Hi, may I work on applications/plot_cyclical_feature_engineering.html?

@ArturoAmorQ
Copy link
Member Author

Hi, may I work on applications/plot_cyclical_feature_engineering.html?

Sure, feel free to open a PR mentioning this issue :)

@GeorgiaMayDay
Copy link
Contributor

GeorgiaMayDay commented Nov 10, 2022

Sorry, this is my first time contributing to sci-learn. When you say fix, should we make it so the future warnings are accurate and change the defaults? Or instead address the TODO's in the code and then remove the warnings?

So, in the case of https://scikit-learn.org/dev/auto_examples/cluster/plot_color_quantization.html - should I:

  • Change default_n_init to 10
    or
  • Fix it so default_n_init is set by auto

@ArturoAmorQ
Copy link
Member Author

ArturoAmorQ commented Nov 10, 2022

Sorry, this is my first time contributing to sci-learn. When you say fix, should we make it so the future warnings are accurate and change the defaults? Or instead address the TODO's in the code and then remove the warnings?

You have to change the code of each given example so that the warning is no longer raised. In the case of cluster/plot_color_quantization.html the message says

Set the value of `n_init` explicitly to suppress the warning.

So the thing to do is to set n_init=5 explicitly, i.e.

print("Fitting model on a small sub-sample of the data")
t0 = time()
image_array_sample = shuffle(image_array, random_state=0, n_samples=1_000)
- kmeans = KMeans(n_clusters=n_colors, random_state=0).fit(image_array_sample)
+ kmeans = KMeans(n_clusters=n_colors, n_init="auto", random_state=0).fit(image_array_sample)
print(f"done in {time() - t0:0.3f}s.")

@aditya-anulekh
Copy link
Contributor

Submitted a PR to fix FutureWarning in examples/cluster/plot_bisect_kmeans.py

@DhanshreeA
Copy link
Contributor

Working on ensemble/plot_gradient_boosting_categorical.html

@Ti-Ion
Copy link
Contributor

Ti-Ion commented Nov 14, 2022

Working on cluster/plot_dict_face_patches.html

@SarahRemus
Copy link
Contributor

Working on inspection/plot_linear_model_coefficient_interpretation.html

@Reddragonemperor58
Copy link
Contributor

@Reddragonemperor58
Copy link
Contributor

Reddragonemperor58 commented Nov 15, 2022

Hi @ArturoAmorQ I am working on cross_decomposition and I found the future warning i.e., "_/srv/conda/envs/notebook/lib/python3.9/site-packages/sklearn/cross_decomposition/pls.py:503: FutureWarning: The attribute coef_ will be transposed in version 1.3 to be consistent with other linear models in scikit-learn. Currently, coef_ has a shape of (n_features, n_targets) and in the future, it will have a shape of (n_targets, n_features).
warnings.warn(
"

This warning cannot be suppressed by changing anything from the code in documentation, I think we need to edit the main file of 'coef_' from here: https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/cross_decomposition/_pls.py

In line number 504 we need to make changes. Or we can just suppress it by using simplefilter.
Could you confirm it?

@ArturoAmorQ
Copy link
Member Author

This warning cannot be suppressed by changing anything from the code in documentation, I think we need to edit the main file of 'coef_' from here: main/sklearn/cross_decomposition/_pls.py

In line number 504 we need to make changes. Or we can just suppress it by using simplefilter. Could you confirm it?

Changing the coef_ function is a TODO for version 1.3, so this should not be changed for the moment. I think it's better not to change the example either.

We will have to keep this particular example in mind. Thanks for the report @Reddragonemperor58 !

@Reddragonemperor58
Copy link
Contributor

Reddragonemperor58 commented Nov 15, 2022

Welcome, you could remove it from the list.

@jpangas
Copy link
Contributor

jpangas commented Nov 15, 2022

Working on decomposition/plot_faces_decomposition.html

@Reddragonemperor58
Copy link
Contributor

@Reddragonemperor58
Copy link
Contributor

Hey @ArturoAmorQ for model_selection/plot_successive_halving_heatmap.html the warning raised is "In a future version, the Index constructor will not infer numeric dtypes when passed object-dtype sequences (matching Series behavior)" is it okay to suppress the warning using ignore as they did it in pandas issue ?

@edenies
Copy link
Contributor

edenies commented Nov 15, 2022

@Reddragonemperor58
Copy link
Contributor

working on manifold/plot_manifold_sphere.html

@edenies
Copy link
Contributor

edenies commented Nov 15, 2022

Reddragonemperor58 added a commit to Reddragonemperor58/scikit-learn that referenced this issue Nov 15, 2022
Related to scikit-learn#24876
What does this implement/fix? Explain your changes.

Fix FutureWarning in manifold/plot_manifold_sphere.html

/home/runner/work/scikit-learn/scikit-learn/sklearn/manifold/_mds.py:299: FutureWarning:

The default value of `normalized_stress` will change to `'auto'` in version 1.4. To suppress this warning, manually set the value of `normalized_stress`.

by explicit passing normalized_stress="auto"
@Reddragonemperor58
Copy link
Contributor

@isaac-chung
Copy link

isaac-chung commented Nov 16, 2022

@ArturoAmorQ
Copy link
Member Author

Thanks to everyone who contributed on this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation good first issue Easy with clear instructions to resolve Meta-issue General issue associated to an identified list of tasks
Projects
None yet
Development

No branches or pull requests

10 participants