An advanced trainer accepts the same hyperparameter twice and emits Python that will not compile
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### What happened?
A hyperparameter row on an Advanced trainer names the parameter it sets, and the operator emits one keyword argument per row. Nothing stops two rows from naming the same parameter, and two rows naming one parameter emit that keyword twice:
```
SVC(C = float ("1.0"), C = float ("2.0"),)
```
Python rejects that while it compiles the operator, before any of it runs:
```
SyntaxError: keyword argument repeated: C
```
The run ends there, and what the user is shown points at a line of generated code rather than at the row they added.
`paraList` carries no constraint of any kind, so the form takes the second row without comment. `uniqueItems` is not the constraint that is missing either: two rows naming `C` with different values are distinct rows, and the emitted code repeats the keyword all the same. What has to be unique is the `parameter` field across the rows, which no row can state about itself.
Where to catch it is worth deciding in the PR rather than here. Refusing the second row in the form is the earliest point. The descriptor could also refuse it while the workflow compiles, which is where the user gets an error naming the operator and the parameter instead of a Python traceback.
### How to reproduce?
Add an Advanced 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 two rows under Parameter Setting and pick `C` in both, giving them any values. Run. The operator fails to compile with a repeated-keyword SyntaxError. Every Advanced trainer behaves the same way, the parameter list being the only thing that differs between them.
### Version/Branch
1.3.0-incubating-SNAPSHOT (main)
### Relevant log output
```shell
File "", line 24
SyntaxError: keyword argument repeated: C
```
Contributor guide
Research direction
Start at the Advanced trainer parameter-setting form and follow paraList into the descriptor or workflow-compilation path; no specific files or tests are named. Reproduce the duplicate C parameter case, then determine where validation belongs so duplicate parameters are rejected with an error naming the operator and parameter before invalid Python is emitted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, scala
- Domain
- backend, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100