scikit-learn / scikit-learn/scikit-learn
Give feedback when `svm.SVC` is configured with kernel hyperparameters for a different kernel
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 67.3k
- Forks
- 27.4k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 58
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at sklearn.svm.SVC and its fit workflow, using the linear-kernel/gamma example as the first case. Determine which configured hyperparameters are ineffective for each kernel, provide feedback without changing model results, and add coverage for the relevant kernel combinations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100