What happened?
SklearnAdvancedSVCParameters and SklearnAdvancedSVRParameters pair each hyperparameter with the Python callable that converts the user's text. gamma names float, so the operator emits gamma = float(value).
scikit-learn accepts two different kinds of value for this parameter: one of the words scale and auto, or a non-negative number. scale is the default, and it is what makes the estimator derive gamma from the training data rather than having it pinned to a constant. Under float neither word survives:
float('scale') -> ValueError: could not convert string to float: 'scale'
So the parameter can only ever be given an explicit number, and the mode most users want is unreachable.
Naming str instead does not fix it, it only moves the loss to the other half. str turns 0.1 into the string '0.1', which scikit-learn then refuses:
The 'gamma' parameter of SVC must be a str among {'auto', 'scale'} or a float in the range [0.0, inf). Got '0.1' instead.
A correction to an earlier reading of this: one converter is enough. The column names a Python expression rather than a type, which the boolean parameters already use for a lambda, so a lambda that hands the two words through and puts everything else past float() carries both kinds of value. ParamClass needs no new shape. The declaration is simply the wrong one, as in #7593, it is just that no converter named after a type is the right one here.
Related: #7593 covers two KNN parameters with the same kind of mistake. Those are each fixed by naming a different type; this one needs an expression instead, and the value it should offer is scale, the estimator's own default.
How to reproduce?
Add an SVM Classifier Trainer, wire a numeric table to its training port and any table to its parameter port, then set the ground truth attribute and the selected features. Add one hyperparameter row, pick gamma, and give it scale. The run ends. auto behaves the same. A number such as 0.1 runs fine, which is the only way the parameter can be used today. The SVM Regressor Trainer behaves identically.
Version/Branch
1.3.0-incubating-SNAPSHOT (main)
Relevant log output
ValueError: could not convert string to float: 'scale'
What happened?
SklearnAdvancedSVCParametersandSklearnAdvancedSVRParameterspair each hyperparameter with the Python callable that converts the user's text.gammanamesfloat, so the operator emitsgamma = float(value).scikit-learn accepts two different kinds of value for this parameter: one of the words
scaleandauto, or a non-negative number.scaleis the default, and it is what makes the estimator derive gamma from the training data rather than having it pinned to a constant. Underfloatneither word survives:So the parameter can only ever be given an explicit number, and the mode most users want is unreachable.
Naming
strinstead does not fix it, it only moves the loss to the other half.strturns0.1into the string'0.1', which scikit-learn then refuses:A correction to an earlier reading of this: one converter is enough. The column names a Python expression rather than a type, which the boolean parameters already use for a lambda, so a lambda that hands the two words through and puts everything else past
float()carries both kinds of value.ParamClassneeds no new shape. The declaration is simply the wrong one, as in #7593, it is just that no converter named after a type is the right one here.Related: #7593 covers two KNN parameters with the same kind of mistake. Those are each fixed by naming a different type; this one needs an expression instead, and the value it should offer is
scale, the estimator's own default.How to reproduce?
Add an SVM Classifier Trainer, wire a numeric table to its training port and any table to its parameter port, then set the ground truth attribute and the selected features. Add one hyperparameter row, pick
gamma, and give itscale. The run ends.autobehaves the same. A number such as0.1runs fine, which is the only way the parameter can be used today. The SVM Regressor Trainer behaves identically.Version/Branch
1.3.0-incubating-SNAPSHOT (main)
Relevant log output
ValueError: could not convert string to float: 'scale'