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

Skip to content

API Accept 'auto' option for 'dual' parameter in LinearSVC and LinearSVR - #26093

Merged
adrinjalali merged 113 commits into
scikit-learn:mainfrom
glevv:linsvm-dual-auto
May 30, 2023
Merged

API Accept 'auto' option for 'dual' parameter in LinearSVC and LinearSVR#26093
adrinjalali merged 113 commits into
scikit-learn:mainfrom
glevv:linsvm-dual-auto

Conversation

@glevv

@glevv glevv commented Apr 5, 2023

Copy link
Copy Markdown
Contributor

Fixes #24651
closes #24731

🤖 Generated by Copilot at cd87daa

Set dual to "auto" for LinearSVC and LinearSVR in some tests to avoid future warnings. This is a temporary fix for compatibility with the upcoming version of scikit-learn.

@adrinjalali adrinjalali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the updates, I'm doing a git grep -A3 LinearSVC to find instances we're missing, and there are some, eg.:

benchmarks/bench_mnist.py:        Nystroem(gamma=0.015, n_components=1000), LinearSVC(C=100)
benchmarks/bench_mnist.py-    ),
benchmarks/bench_mnist.py-    "SampledRBF-SVM": make_pipeline(
benchmarks/bench_mnist.py:        RBFSampler(gamma=0.015, n_components=1000), LinearSVC(C=100)

examples/miscellaneous/plot_kernel_approximation.py-nystroem_approx_svm = pipeline.Pipeline(
examples/miscellaneous/plot_kernel_approximation.py:    [("feature_map", feature_map_nystroem), ("svm", svm.LinearSVC())]
examples/miscellaneous/plot_kernel_approximation.py-)
examples/miscellaneous/plot_kernel_approximation.py-

examples/model_selection/plot_grid_search_refit_callable.py:        ("classify", LinearSVC(random_state=42, C=0.01)),
examples/model_selection/plot_grid_search_refit_callable.py-    ]
examples/model_selection/plot_grid_search_refit_callable.py-)

examples/model_selection/plot_precision_recall.py:classifier = make_pipeline(StandardScaler(), LinearSVC(random_state=random_state))
examples/model_selection/plot_precision_recall.py-classifier.fit(X_train, y_train)

examples/model_selection/plot_precision_recall.py:    make_pipeline(StandardScaler(), LinearSVC(random_state=random_state))

examples/preprocessing/plot_discretization_classification.py:        make_pipeline(StandardScaler(), LinearSVC(random_state=0)),

...

I haven't checked them all, but I think there's more.

@scikit-learn/core-devs since this is something used so much, I wonder if we want to change the default. WDYT?

@glevv

glevv commented May 8, 2023

Copy link
Copy Markdown
Contributor Author

Yep, maybe it should be done without changing the default

@glemaitre

Copy link
Copy Markdown
Member

We previously did similar things for the scale parameter. It will be beneficial in terms of performance, so why not. Deprecations are always annoying.

@glemaitre

Copy link
Copy Markdown
Member

True that I did not think about changing the examples and benchmark.

@adrinjalali

Copy link
Copy Markdown
Member

Could you please send a commit with [doc build] in the commit message so that we test the whole doc build as well?

@glevv

glevv commented May 20, 2023

Copy link
Copy Markdown
Contributor Author

@adrinjalali will do

@adrinjalali adrinjalali left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm going to give @scikit-learn/core-devs a few days to object here (if any), otherwise happy to merge in a few days.

Thanks for the awesome work @glevv

@adrinjalali
adrinjalali merged commit b32e5c7 into scikit-learn:main May 30, 2023
@glevv
glevv deleted the linsvm-dual-auto branch May 31, 2023 17:01
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
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.

Default value for solving an SVM in primal and dual should be determined automatically

4 participants