Table of Contents

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

T

The numeric type.

TInput

The input type.

TOutput

The 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

model IFullModel<T, TInput, TOutput>

The adapted model.

optimizer PerParameterOptimizer<T, TInput, TOutput>

The per-parameter optimizer used for adaptation.

options MetaSGDOptions<T, TInput, TOutput>

The Meta-SGD options.

Properties

Metadata

Gets the model metadata.

public ModelMetadata<T> Metadata { get; }

Property Value

ModelMetadata<T>

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

input TInput

The input data.

Returns

TOutput

The model predictions.

SetParameters(Vector<T>)

Sets the model parameters.

public void SetParameters(Vector<T> parameters)

Parameters

parameters Vector<T>

The new parameters.

Train(TInput, TOutput)

Trains the model on the given data.

public void Train(TInput inputs, TOutput targets)

Parameters

inputs TInput

The input data.

targets TOutput

The 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.