LEOModel<T, TInput, TOutput>
Models & Types · AiDotNet.MetaLearning.Models
LEO model for few-shot classification with latent space optimization.
Implements: IModel<TInput, TOutput, ModelMetadata<T>>
For Beginners
After LEO adapts to a new task by optimizing in latent space, this model stores:
How It Works
The adapted state of LEO for one task: its own copy of the feature encoder, the linear softmax classifier LEO
generated and adapted - one weight row per class - and the adapted latent codes. Predict returns
class probabilities per example, [rows, NumClasses], for Tensor and Matrix outputs - a class the task did
not contain gets probability zero - and the most probable class of each example for a Vector output.
Constructors
| Constructor | Summary |
|---|---|
LEOModel(IFullModel<T, TInput, TOutput> featureEncoder, Vector<T> classifierParams, Vector<T> latentCode, LEOOptions<T, TInput, TOutput> options) |
Initializes a new instance of the LEOModel with one classifier row per class, class c in row c. |
Properties
| Property | Summary |
|---|---|
ModelMetadata<T> Metadata { get; } |
|
Vector<T> ClassifierParams { get; } |
Gets the adapted classifier parameters, one row of EmbeddingDimension weights per class. |
Vector<T> LatentCode { get; } |
Gets the optimized latent code, one LatentDimension block per class. |
int LatentDimension { get; } |
Gets the latent dimension. |
int NumClasses { get; } |
Gets the number of classes. |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |
|
TOutput Predict(TInput input) |
|
Vector<T> GetParameters() |
|
void Train(TInput inputs, TOutput targets) |
|
void UpdateParameters(Vector<T> parameters) |