RandomSearchOptimizer<T, TInput, TOutput>
Models & Types · AiDotNet.HyperparameterOptimization
Implements random search hyperparameter optimization.
Inheritance: HyperparameterOptimizerBase<T, TInput, TOutput> → RandomSearchOptimizer<T, TInput, TOutput>
How It Works
For Beginners: Random search randomly tries different hyperparameter combinations. While simple, it’s surprisingly effective and often outperforms grid search, especially when some hyperparameters are more important than others.
How it works:
- Randomly sample hyperparameter values from the search space
- Train/evaluate the model with those hyperparameters
- Record the results
- Repeat for the specified number of trials
- Return the best configuration found
Constructors
| Constructor | Summary |
|---|---|
RandomSearchOptimizer(bool maximize, int? seed) |
Initializes a new instance of the RandomSearchOptimizer class. |
Methods
| Method | Summary |
|---|---|
Dictionary<string, object> SuggestNext(HyperparameterTrial<T> trial) |
Suggests the next hyperparameter configuration to try. |
HyperparameterOptimizationResult<T> Optimize(Func<Dictionary<string, object>, T> objectiveFunction, HyperparameterSearchSpace searchSpace, int nTrials) |
Searches for the best hyperparameter configuration. |