PrototypicalModel<T, TInput, TOutput>
Models & Types · AiDotNet.MetaLearning.Algorithms
Prototypical model for few-shot classification.
Implements: IModel<TInput, TOutput, ModelMetadata<T>>
For Beginners
After adapting ProtoNets to a new task, you get this model. It classifies new examples instantly by finding the nearest class prototype.
How It Works
The adapted state of ProtoNets for one task: its own copy of the embedding, the class prototypes of the support
set, and the learned metric. Predict returns class probabilities, [rows, classes], for Tensor
and Matrix outputs, and the most probable class of each example for a Vector output.
Constructors
| Constructor | Summary |
|---|---|
PrototypicalModel(IFullModel<T, TInput, TOutput> featureEncoder, TInput supportInputs, TOutput supportOutputs, ProtoNetsOptions<T, TInput, TOutput> options, INumericOperations<T> numOps) |
Initializes a new instance of the PrototypicalModel with the paper’s metric. |
Properties
| Property | Summary |
|---|---|
ModelMetadata<T> Metadata { get; } |
Gets the model metadata. |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |
Gets metadata about the model. |
TOutput Predict(TInput input) |
Makes predictions using prototype-based classification. |
Vector<T> GetParameters() |
Gets model parameters (not applicable for prototype-based models). |
void Train(TInput inputs, TOutput targets) |
Trains the model (not applicable for prototype-based models). |
void UpdateParameters(Vector<T> parameters) |
Updates model parameters (not applicable for prototype-based models). |