Interface IAutoMLModel<T, TInput, TOutput>
- Namespace
- AiDotNet.Interfaces
- Assembly
- AiDotNet.dll
Defines the contract for AutoML models that automatically search for optimal model configurations.
public interface IAutoMLModel<T, TInput, TOutput> : IFullModel<T, TInput, TOutput>, IModel<TInput, TOutput, ModelMetadata<T>>, IModelSerializer, ICheckpointableModel, IParameterizable<T, TInput, TOutput>, IFeatureAware, IFeatureImportance<T>, ICloneable<IFullModel<T, TInput, TOutput>>, IGradientComputable<T, TInput, TOutput>, IJitCompilable<T>
Type Parameters
TThe numeric type used for calculations
TInputThe input data type
TOutputThe output data type
- Inherited Members
- Extension Methods
Remarks
AutoML (Automated Machine Learning) models automatically search through different model types, hyperparameters, and architectures to find the best configuration for a given dataset. This interface extends IFullModel to provide AutoML-specific functionality like search space configuration, trial management, and optimization settings.
Properties
BestModel
Gets the best model found so far
IFullModel<T, TInput, TOutput>? BestModel { get; }
Property Value
- IFullModel<T, TInput, TOutput>
BestScore
Gets the best score achieved
double BestScore { get; }
Property Value
Status
Gets the current optimization status
AutoMLStatus Status { get; }
Property Value
TimeLimit
Gets or sets the time limit for the AutoML search
TimeSpan TimeLimit { get; set; }
Property Value
TrialLimit
Gets or sets the maximum number of trials to run
int TrialLimit { get; set; }
Property Value
Methods
ConfigureSearchSpace(Dictionary<string, ParameterRange>)
Configures the search space for hyperparameter optimization
void ConfigureSearchSpace(Dictionary<string, ParameterRange> searchSpace)
Parameters
searchSpaceDictionary<string, ParameterRange>Dictionary defining parameter ranges to search
EnableEarlyStopping(int, double)
Enables early stopping
void EnableEarlyStopping(int patience, double minDelta = 0.001)
Parameters
patienceintNumber of trials without improvement before stopping
minDeltadoubleMinimum change to be considered an improvement
EnableNAS(bool)
Enables Neural Architecture Search (NAS) for automatic network design
void EnableNAS(bool enabled = true)
Parameters
enabledboolWhether to enable NAS
GetFeatureImportanceAsync()
Gets feature importance from the best model
Task<Dictionary<int, double>> GetFeatureImportanceAsync()
Returns
- Task<Dictionary<int, double>>
Dictionary mapping feature indices to importance scores
GetResults()
Gets the results of all trials performed during search
List<TrialResult> GetResults()
Returns
- List<TrialResult>
List of trial results with scores and parameters
GetTrialHistory()
Gets the history of all trials
List<TrialResult> GetTrialHistory()
Returns
- List<TrialResult>
List of trial results
ReportTrialResultAsync(Dictionary<string, object>, double, TimeSpan)
Reports the result of a trial
Task ReportTrialResultAsync(Dictionary<string, object> parameters, double score, TimeSpan duration)
Parameters
parametersDictionary<string, object>The parameters used in the trial
scoredoubleThe score achieved
durationTimeSpanThe duration of the trial
Returns
Run(TInput, TOutput, TInput, TOutput)
Runs the AutoML optimization process (alternative name for Search)
void Run(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets)
Parameters
inputsTInputTraining inputs
targetsTOutputTraining targets
validationInputsTInputValidation inputs
validationTargetsTOutputValidation targets
Search(TInput, TOutput, TInput, TOutput)
Performs the AutoML search process (synchronous version)
void Search(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets)
Parameters
inputsTInputTraining inputs
targetsTOutputTraining targets
validationInputsTInputValidation inputs
validationTargetsTOutputValidation targets
SearchAsync(TInput, TOutput, TInput, TOutput, TimeSpan, CancellationToken)
Searches for the best model configuration asynchronously
Task<IFullModel<T, TInput, TOutput>> SearchAsync(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets, TimeSpan timeLimit, CancellationToken cancellationToken = default)
Parameters
inputsTInputTraining inputs
targetsTOutputTraining targets
validationInputsTInputValidation inputs
validationTargetsTOutputValidation targets
timeLimitTimeSpanTime limit for the search
cancellationTokenCancellationTokenCancellation token
Returns
- Task<IFullModel<T, TInput, TOutput>>
The best model found
SearchBestModel(TInput, TOutput, TInput, TOutput)
Searches for the best model configuration (synchronous version)
IFullModel<T, TInput, TOutput> SearchBestModel(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets)
Parameters
inputsTInputTraining inputs
targetsTOutputTraining targets
validationInputsTInputValidation inputs
validationTargetsTOutputValidation targets
Returns
- IFullModel<T, TInput, TOutput>
Best model found
SetCandidateModels(List<ModelType>)
Sets the models to consider in the search
void SetCandidateModels(List<ModelType> modelTypes)
Parameters
SetConstraints(List<SearchConstraint>)
Sets constraints for the search
void SetConstraints(List<SearchConstraint> constraints)
Parameters
constraintsList<SearchConstraint>List of search constraints
SetModelEvaluator(IModelEvaluator<T, TInput, TOutput>)
Sets the model evaluator to use for evaluating candidate models
void SetModelEvaluator(IModelEvaluator<T, TInput, TOutput> evaluator)
Parameters
evaluatorIModelEvaluator<T, TInput, TOutput>The model evaluator
SetModelsToTry(List<ModelType>)
Sets which model types should be considered during the search
void SetModelsToTry(List<ModelType> modelTypes)
Parameters
SetOptimizationMetric(MetricType, bool)
Sets the optimization metric
void SetOptimizationMetric(MetricType metric, bool maximize = true)
Parameters
metricMetricTypeThe metric to optimize
maximizeboolWhether to maximize (true) or minimize (false) the metric
SetSearchSpace(Dictionary<string, ParameterRange>)
Sets the search space for hyperparameters
void SetSearchSpace(Dictionary<string, ParameterRange> searchSpace)
Parameters
searchSpaceDictionary<string, ParameterRange>Dictionary defining parameter ranges to search
SetTimeLimit(TimeSpan)
Sets the time limit for the AutoML search process
void SetTimeLimit(TimeSpan timeLimit)
Parameters
timeLimitTimeSpanMaximum time to spend searching for optimal models
SetTrialLimit(int)
Sets the maximum number of trials to execute during search
void SetTrialLimit(int maxTrials)
Parameters
maxTrialsintMaximum number of model configurations to try
SuggestNextTrialAsync()
Suggests the next hyperparameters to try
Task<Dictionary<string, object>> SuggestNextTrialAsync()
Returns
- Task<Dictionary<string, object>>
Dictionary of suggested parameter values