RandomSearchAutoML<T, TInput, TOutput>
Models & Types · AiDotNet.AutoML
AutoML implementation that uses random search over candidate model types and hyperparameters.
Inheritance: AutoMLModelBase<T, TInput, TOutput> → SupervisedAutoMLModelBase<T, TInput, TOutput> → BuiltInSupervisedAutoMLModelBase<T, TInput, TOutput> → RandomSearchAutoML<T, TInput, TOutput>
For Beginners
This AutoML strategy works like this:
- Pick a model type at random (for example, Random Forest or Logistic Regression).
- Pick a set of settings at random (for example, number of trees).
- Train the model and score it on validation data.
- Repeat and keep the best result.
If you are new to AutoML, random search is a good first choice because it is reliable and easy to reason about.
How It Works
Random search is a strong baseline for AutoML. It is simple, parallelizable, and often competitive with more complex search strategies for a given compute budget.
Example
var valTargets = new Vector<double>(new double[] { 0.0, 1.0, 0.0, 1.0 });
var valInputs = new Matrix<double>(new double[,] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 }, { 7.0, 8.0 } });
var trainTargets = new Vector<double>(new double[] { 0.0, 1.0, 0.0, 1.0 });
var trainInputs = new Matrix<double>(new double[,] { { 1.0, 2.0 }, { 3.0, 4.0 }, { 5.0, 6.0 }, { 7.0, 8.0 } });
var automl = new RandomSearchAutoML<double, Matrix<double>, Vector<double>>();
var bestModel = await automl.SearchAsync(
trainInputs, trainTargets,
valInputs, valTargets,
timeLimit: TimeSpan.FromMinutes(5));
Constructors
| Constructor | Summary |
|---|---|
RandomSearchAutoML(Random random) |
Methods
| Method | Summary |
|---|---|
Task<Dictionary<string, object>> SuggestNextTrialAsync() |
|
Task<IFullModel<T, TInput, TOutput>> SearchAsync(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets, TimeSpan timeLimit, CancellationToken cancellationToken) |