Table of Contents

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

T

The numeric type used for calculations

TInput

The input data type

TOutput

The 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

double

Status

Gets the current optimization status

AutoMLStatus Status { get; }

Property Value

AutoMLStatus

TimeLimit

Gets or sets the time limit for the AutoML search

TimeSpan TimeLimit { get; set; }

Property Value

TimeSpan

TrialLimit

Gets or sets the maximum number of trials to run

int TrialLimit { get; set; }

Property Value

int

Methods

ConfigureSearchSpace(Dictionary<string, ParameterRange>)

Configures the search space for hyperparameter optimization

void ConfigureSearchSpace(Dictionary<string, ParameterRange> searchSpace)

Parameters

searchSpace Dictionary<string, ParameterRange>

Dictionary defining parameter ranges to search

EnableEarlyStopping(int, double)

Enables early stopping

void EnableEarlyStopping(int patience, double minDelta = 0.001)

Parameters

patience int

Number of trials without improvement before stopping

minDelta double

Minimum change to be considered an improvement

EnableNAS(bool)

Enables Neural Architecture Search (NAS) for automatic network design

void EnableNAS(bool enabled = true)

Parameters

enabled bool

Whether 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

parameters Dictionary<string, object>

The parameters used in the trial

score double

The score achieved

duration TimeSpan

The duration of the trial

Returns

Task

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

inputs TInput

Training inputs

targets TOutput

Training targets

validationInputs TInput

Validation inputs

validationTargets TOutput

Validation targets

Search(TInput, TOutput, TInput, TOutput)

Performs the AutoML search process (synchronous version)

void Search(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets)

Parameters

inputs TInput

Training inputs

targets TOutput

Training targets

validationInputs TInput

Validation inputs

validationTargets TOutput

Validation 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

inputs TInput

Training inputs

targets TOutput

Training targets

validationInputs TInput

Validation inputs

validationTargets TOutput

Validation targets

timeLimit TimeSpan

Time limit for the search

cancellationToken CancellationToken

Cancellation 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

inputs TInput

Training inputs

targets TOutput

Training targets

validationInputs TInput

Validation inputs

validationTargets TOutput

Validation 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

modelTypes List<ModelType>

List of model types to evaluate

SetConstraints(List<SearchConstraint>)

Sets constraints for the search

void SetConstraints(List<SearchConstraint> constraints)

Parameters

constraints List<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

evaluator IModelEvaluator<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

modelTypes List<ModelType>

List of model types to evaluate

SetOptimizationMetric(MetricType, bool)

Sets the optimization metric

void SetOptimizationMetric(MetricType metric, bool maximize = true)

Parameters

metric MetricType

The metric to optimize

maximize bool

Whether 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

searchSpace Dictionary<string, ParameterRange>

Dictionary defining parameter ranges to search

SetTimeLimit(TimeSpan)

Sets the time limit for the AutoML search process

void SetTimeLimit(TimeSpan timeLimit)

Parameters

timeLimit TimeSpan

Maximum time to spend searching for optimal models

SetTrialLimit(int)

Sets the maximum number of trials to execute during search

void SetTrialLimit(int maxTrials)

Parameters

maxTrials int

Maximum 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