AutoMLModelBase<T, TInput, TOutput>
Base Classes · AiDotNet.AutoML
Base class for AutoML models that automatically search for optimal model configurations
Implements: IAutoMLModel<T, TInput, TOutput>, IModelShape
Known derived types: DiffusionAutoML<T>, NasAutoMLModelBase<T>, SupervisedAutoMLModelBase<T, TInput, TOutput>
Properties
| Property | Summary |
|---|---|
AutoMLStatus Status { get; set; } |
Gets the model type |
IFullModel<T, TInput, TOutput> BestModel { get; set; } |
Gets the best model found so far |
ILossFunction<T> DefaultLossFunction { get; } |
Gets the default loss function for gradient computation. |
MetricType OptimizationMetric { get; } |
Gets the optimization metric used to rank trials. |
TimeSpan TimeLimit { get; set; } |
Gets or sets the time limit for the AutoML search |
bool MaximizeOptimizationMetric { get; } |
Gets a value indicating whether higher metric values are better. |
bool SupportsParameterInitialization { get; } |
|
double BestScore { get; set; } |
Gets the best score achieved |
int TrialLimit { get; set; } |
Gets or sets the maximum number of trials to run |
long ParameterCount { get; } |
Gets the number of parameters |
string[] FeatureNames { get; set; } |
Gets the feature names |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> GetFeatureImportance() |
Gets the feature importance scores |
DynamicShapeInfo GetDynamicShapeInfo() |
|
IEnumerable<Tensor<T>> GetParameterChunks() |
Streams the selected model’s parameters without flattening a neural model. |
IEnumerable<int> GetActiveFeatureIndices() |
Gets the indices of active features |
IFullModel<T, TInput, TOutput> Clone() |
Creates a memberwise clone of the AutoML model using MemberwiseClone(). |
IFullModel<T, TInput, TOutput> DeepCopy() |
Creates a deep copy of the AutoML model |
IFullModel<T, TInput, TOutput> SearchBestModel(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets) |
Searches for the best model configuration (synchronous version) |
IFullModel<T, TInput, TOutput> WithParameters(Vector<T> parameters) |
Creates a new instance with the given parameters |
List<TrialResult> GetResults() |
Gets the results of all trials performed during search |
List<TrialResult> GetTrialHistory() |
Gets the history of all trials |
ModelMetadata<T> GetModelMetadata() |
Gets model metadata |
TOutput Predict(TInput input) |
Makes predictions using the best model found |
Task ReportTrialResultAsync(Dictionary<string, object> parameters, double score, TimeSpan duration) |
Reports the result of a trial |
Task<Dictionary<int, double>> GetFeatureImportanceAsync() |
Gets feature importance from the best model |
Task<Dictionary<string, object>> SuggestNextTrialAsync() |
Suggests the next hyperparameters to try |
Task<IFullModel<T, TInput, TOutput>> SearchAsync(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets, TimeSpan timeLimit, CancellationToken cancellationToken) |
Searches for the best model configuration |
Vector<T> ComputeGradients(TInput input, TOutput target, ILossFunction<T> lossFunction) |
Computes gradients by delegating to the best model. |
Vector<T> GetParameters() |
Gets the model parameters |
Vector<T> SanitizeParameters(Vector<T> parameters) |
|
bool IsFeatureUsed(int featureIndex) |
Checks if a feature is used |
byte[] Serialize() |
Serializes the model to bytes |
double[] Predict(double[][] inputs) |
Makes predictions using the best model found |
int[] GetInputShape() |
Saves the model to a file |
int[] GetOutputShape() |
|
void ApplyGradients(Vector<T> gradients, T learningRate) |
Applies gradients by delegating to the best model. |
void ConfigureSearchSpace(Dictionary<string, ParameterRange> searchSpace) |
Configures the search space for hyperparameter optimization |
void Deserialize(byte[] data) |
Deserializes the model from bytes |
void Dispose() |
|
void EnableEarlyStopping(int patience, double minDelta) |
Enables early stopping |
void EnableNAS(bool enabled) |
Enables Neural Architecture Search (NAS) for automatic network design |
void LoadModel(string filePath) |
Loads the model from a file |
void LoadState(Stream stream) |
Loads the AutoML model’s state from a stream. |
void Run(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets) |
Runs the AutoML optimization process (alternative name for Search) |
void SaveModel(string filePath) |
|
void SaveState(Stream stream) |
Saves the AutoML model’s current state to a stream. |
void Search(TInput inputs, TOutput targets, TInput validationInputs, TOutput validationTargets) |
Performs the AutoML search process (synchronous version) |
void SetActiveFeatureIndices(IEnumerable<int> featureIndices) |
Sets the active feature indices |
void SetCandidateModels(List<Type> modelTypes) |
Sets the models to consider in the search |
void SetConstraints(List<SearchConstraint> constraints) |
Sets constraints for the search |
void SetModelsToTry(List<Type> modelTypes) |
Sets which model types should be considered during the search |
void SetOptimizationMetric(MetricType metric, bool maximize) |
Sets the optimization metric |
void SetParameterChunks(IEnumerable<Tensor<T>> chunks) |
Restores through the selected model while retaining derived setter contracts. |
void SetParameters(Vector<T> parameters) |
Sets the model parameters |
void SetSearchSpace(Dictionary<string, ParameterRange> searchSpace) |
Sets the search space for hyperparameters |
void SetTimeLimit(TimeSpan timeLimit) |
Sets the time limit for the AutoML search process |
void SetTrialLimit(int maxTrials) |
Sets the maximum number of trials to execute during search |
void Train(TInput input, TOutput expectedOutput) |
Trains the AutoML model by searching for the best configuration |
void Train(double[][] inputs, double[] outputs) |
Trains the AutoML model by searching for the best configuration |