Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MAINT make sure that x0 is 1D when passed to minimize #23659

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

Merged
merged 1 commit into from
Jun 21, 2022

Conversation

glemaitre
Copy link
Member

Related to #23626

minimize validates the input and x0 should be a 1D array in the future.

Copy link
Member

@lesteve lesteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine.

It looks like we were using a slightly unsupported behaviour. It seems to be working as expected even if the array was multi-dimensional and scipy.optimize.minimize expects a 1d array for its x0 parameter.

Edit: in this case we are using LBFGS which does the x0.ravel() anyway so we were fine I think: https://github.com/scipy/scipy/blob/5f92e82876e876bb8132c6ad9ed53c500e05f93e/scipy/optimize/_lbfgsb_py.py#L277

Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm that this fixed fixes the test_estimators[NeighborhoodComponentsAnalysis() test with -Werror::DeprecationWarning

LGTM

@thomasjpfan thomasjpfan merged commit 67c7984 into scikit-learn:main Jun 21, 2022
ogrisel pushed a commit to ogrisel/scikit-learn that referenced this pull request Jul 11, 2022
glemaitre added a commit to glemaitre/scikit-learn that referenced this pull request Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants