Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Give feedback when svm.SVC is configured with kernel hyperparameters for a different kernel #19614

Copy link
Copy link
Open
@PGijsbers

Description

@PGijsbers
Issue body actions

During our class we noticed some students incorrectly configure some hyperparameters which are irrelevant to the kernel used, for example setting gamma when using a linear kernel. We think it could make sense for scikit-learn to give feedback to the user when non-effective settings are configured.

Describe the workflow you want to enable

from sklearn.datasets import load_iris
from sklearn.svm import SVC

x, y = load_iris(return_X_y=True)
clf = SVC(kernel='linear', gamma=1e-6)
clf.fit(x, y)
print(clf.score(x, y))

current output:

0.9933333333333333

proposed output, something similar to:

UserWarning: Gamma is set but not used because a linear kernel is configured.
0.9933333333333333

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.