8000 Give feedback when `svm.SVC` is configured with kernel hyperparameters for a different kernel · Issue #19614 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
Give feedback when svm.SVC is configured with kernel hyperparameters for a different kernel #19614
Open
@PGijsbers

Description

@PGijsbers

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

      0