An advanced trainer's hyperparameter value is unconstrained and never required, so a wrong or missing one only fails once the run starts
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### What happened?
The four advanced Sklearn trainers (SVC, SVR, KNN Classifier, KNN Regressor) take their hyperparameters as a table. Each row picks a parameter from a dropdown and supplies a value beside it. The parameter is a real dropdown, backed by an enum. The value is a plain text box carrying nothing at all: no allowed values, no format, no default, not even a title or a description.
Each parameter's legal values are fixed, and the code already knows them. The same enum that fills the dropdown pairs every parameter with the Python converter its text goes through, so `C` is a float, `degree` is an int, `kernel` is a string and `probability` is a boolean. For the string ones scikit-learn accepts a fixed set of words, and the set differs per parameter: `kernel` takes one of five, `weights` one of two, `algorithm` one of four. Every parameter also has a default of its own in scikit-learn, `rbf` for `kernel` and 1.0 for `C`.
None of that reaches the form. Typing `1` for `kernel` is accepted by the property editor, saved, and submitted. The run then ends with an error raised inside scikit-learn, naming a constraint the user was never shown. A number behaves the same way: `abc` in `C` is accepted and dies in `float()`.
The value is not required either, so a row can pick a parameter, leave the value empty and submit. `C` then reaches `float("")` and `kernel` reaches scikit-learn as an empty string. Which of the two inputs a row needs depends on `parametersSource`, which decides whether the row reads its value from the text box or from a column, so the requirement is conditional: one of `value` and `attribute` is always needed, and neither is declared.
The value should follow the row it sits in. Picking `kernel` should offer the five words it accepts and nothing else. Picking `C` should take a number and refuse the rest. Leaving it empty should be caught in the editor.
One parameter cannot be constrained without also correcting it. `gamma` is declared with the converter `float`, so the operator emits `gamma = float(value)`. scikit-learn accepts either of the words `scale` and `auto` or a non-negative number, and `scale` is its default, so today neither word survives the converter and the mode most users want is unreachable. Naming `str` instead only moves the loss to the other half: `0.1` reaches scikit-learn as `'0.1'` and is refused. The column names a Python expression rather than a type, which the boolean parameters already use for a lambda, so a single converter that hands the two words through and puts everything else past `float()` carries both kinds of value. The constraint that follows from it is a pattern rather than a set or a type.
Related but separate: #7593 is about two parameters whose declared converter is the wrong one. This is about the value carrying no constraint at all, which affects every parameter in all four trainers.
### 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 `kernel`, and type `1`. The property editor shows no error and the workflow submits. The run ends. Setting `C` to `abc`, or leaving the value empty, does the same on the same workflow.
### Version/Branch
1.3.0-incubating-SNAPSHOT (main)
### Relevant log output
```shell
InvalidParameterError: The 'kernel' parameter of SVC must be a str among
{'poly', 'precomputed', 'rbf', 'sigmoid', 'linear'} or a callable. Got '1' instead.
ValueError: could not convert string to float: 'abc'
ValueError: could not convert string to float: ''
ValueError: could not convert string to float: 'scale'
```
Contributor guide
Research direction
Start at the four advanced Sklearn trainer definitions and the enum that pairs hyperparameters with converters; trace how parametersSource and the property-editor schema describe each row. Reproduce the SVC workflow with invalid, empty, and gamma values, then verify the editor rejects them while allowing the documented parameter choices and numeric forms before submission.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, scala, scikit-learn
- Domain
- frontend, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100