-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
What should we add?
The various trainers in this project inherit from BaseTrainer, but have a different signature for their train() function.
This can cause issues at runtime, but more importantly it creates confusion for users regarding how to use each of the trainers.
There are even cases where different trainers require the same input but with a different name (e.g., reps vs. qaoa_depth or params0 vs previous_optimal_point).
There are several ways to address this:
- It is possible to define a single minimal set of inputs to
train()and make sure that all other parameters are entered at__init__. This is a reasonable solution when the additional parameters really inherently define the trainer and not the specific training run. - Perhaps a set of trainers can be identified that share similar inputs and can then be bunched together in a more coherent inheritance hierarchy. For example, trainers that support initial point can all inherit from a FromInitTrainer (or some other, probably better ;) , name)
Each of these solutions, and even just merging parameters that mean the same with different names, will be backwards incompatible and so require some thought.
Below I provide a table of the parameters each of the classes receives in their train function:
| Trainer Class | cost_op | mixer | initial_state | ansatz_circuit | params0 | reps | degree | folder | file_pattern | parameter_ranges | num_points | lower_bound | upper_bound | seed | previous_optimal_point | trainer1_kwargs | initial_dt | qaoa_depth |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| BaseTrainer | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - | - | - | - | - | - | - | - | - | - | - |
| FixedAngleConjecture | ✓ | ~ | ~ | ~ | ~ | ✓ | ✓ | - | - | - | - | - | - | - | - | - | - | - |
| OptimizedParametersLoader | ~ | ~ | ~ | ~ | ~ | - | - | ✓ | ✓ | - | - | - | - | - | - | - | - | - |
| DepthOneScanTrainer | ✓ | ✓ | ✓ | ✓ | ~ | - | - | - | - | ✓ | ✓ | - | - | - | - | - | - | - |
| DepthOneGammaScanTrainer | ✓ | ~ | ✓ | ✓ | ~ | - | - | - | - | ✓ | ✓ | - | - | - | - | - | - | - |
| QAOAPCA | ✓ | ✓ | ~ | ✓ | ✓ | - | - | - | - | - | - | - | - | - | - | - | - | - |
| RandomPoint | ~ | ~ | ~ | ~ | ~ | ✓ | - | - | - | - | - | ✓ | ✓ | ✓ | - | - | - | - |
| RecursionTrainer | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - | - | - | - | - | - | - | - | - | - |
| RecursiveTransitionStates | ✓ | ✓ | ✓ | ✓ | ~ | ✓ | - | - | - | - | - | - | - | - | ✓ | - | - | - |
| ReweightingTrainer | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - | - | - | - | - | - | - | - | ✓ | - | - |
| ScipyTrainer | ✓ | ✓ | ~ | ✓ | ✓ | - | - | - | - | - | - | - | - | - | - | - | - | - |
| TQATrainer | ✓ | ✓ | ✓ | ✓ | ✓ | ~ | - | - | - | - | - | - | - | - | - | - | ✓ | - |
| TransferTrainer | ✓ | x | x | x | ~ | - | - | - | - | - | - | - | - | - | - | - | - | ✓ |
| TransitionStatesTrainer | ✓ | ✓ | ✓ | ✓ | ~ | - | - | - | - | - | - | - | - | - | ✓ | - | - | - |
Where
- ✓ means that the parameter is accepted and used
- - means that the parameter is not accepted in the API
- x means that the parameter is accepted in the API but an exception is thrown if actually passed
- ~ means that the parameter is accepted but not used
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels