Class MetaSGDAdaptedModel<T, TInput, TOutput>
- Namespace
- AiDotNet.MetaLearning.Algorithms
- Assembly
- AiDotNet.dll
Wrapper model for Meta-SGD adapted models that includes the per-parameter optimizer.
public class MetaSGDAdaptedModel<T, TInput, TOutput> : IModel<TInput, TOutput, ModelMetadata<T>>
Type Parameters
TThe numeric type.
TInputThe input type.
TOutputThe output type.
- Inheritance
-
MetaSGDAdaptedModel<T, TInput, TOutput>
- Implements
-
IModel<TInput, TOutput, ModelMetadata<T>>
- Inherited Members
Remarks
This model wraps an adapted model along with its per-parameter optimizer, allowing for further adaptation or inspection of learned coefficients.
Constructors
MetaSGDAdaptedModel(IFullModel<T, TInput, TOutput>, PerParameterOptimizer<T, TInput, TOutput>, MetaSGDOptions<T, TInput, TOutput>)
Initializes a new instance of the MetaSGDAdaptedModel.
public MetaSGDAdaptedModel(IFullModel<T, TInput, TOutput> model, PerParameterOptimizer<T, TInput, TOutput> optimizer, MetaSGDOptions<T, TInput, TOutput> options)
Parameters
modelIFullModel<T, TInput, TOutput>The adapted model.
optimizerPerParameterOptimizer<T, TInput, TOutput>The per-parameter optimizer used for adaptation.
optionsMetaSGDOptions<T, TInput, TOutput>The Meta-SGD options.
Properties
Metadata
Gets the model metadata.
public ModelMetadata<T> Metadata { get; }
Property Value
Optimizer
Gets the per-parameter optimizer (for inspection or further adaptation).
public PerParameterOptimizer<T, TInput, TOutput> Optimizer { get; }
Property Value
- PerParameterOptimizer<T, TInput, TOutput>
Methods
GetModelMetadata()
Gets the model metadata.
public ModelMetadata<T> GetModelMetadata()
Returns
- ModelMetadata<T>
The metadata for this model.
GetParameters()
Gets the current model parameters.
public Vector<T> GetParameters()
Returns
- Vector<T>
The parameter vector.
Predict(TInput)
Makes predictions using the adapted model.
public TOutput Predict(TInput input)
Parameters
inputTInputThe input data.
Returns
- TOutput
The model predictions.
SetParameters(Vector<T>)
Sets the model parameters.
public void SetParameters(Vector<T> parameters)
Parameters
parametersVector<T>The new parameters.
Train(TInput, TOutput)
Trains the model on the given data.
public void Train(TInput inputs, TOutput targets)
Parameters
inputsTInputThe input data.
targetsTOutputThe target outputs.
Remarks
For Meta-SGD adapted models, training is typically done through the meta-learning adaptation process rather than direct training. This method delegates to the underlying model's training.