UnsupervisedMetaLearnAlgorithm<T, TInput, TOutput>

Models & Types · AiDotNet.MetaLearning.Algorithms

Implementation of CACTUs-MAML, “Unsupervised Learning via Meta-Learning” (Hsu, Levine and Finn, ICLR 2019).

Inheritance: ModelBase<T, TInput, TOutput> → MetaLearnerBase<T, TInput, TOutput> → UnsupervisedMetaLearnAlgorithm<T, TInput, TOutput>

How It Works

CACTUs (Clustering to Automatically Construct Tasks for Unsupervised meta-learning) never reads the labels of the meta-training data. It clusters embeddings of the unlabeled examples with k-means, treats clusters as classes, and builds N-way K-shot pseudo-tasks from them; MAML then meta-trains on the pseudo-tasks. Labels are only used at meta-test time, by Adapt.

Algorithm (paper Algorithm 1, per meta-training batch):

N, K and Q are each slot task’s NumWays, NumShots and NumQueryPerClass, so pseudo-tasks have the episode shape the data loader produces. The embedding is the flattened input (the paper also uses pre-trained unsupervised embeddings; pass embedded inputs to use one). Inputs must be Tensor or Matrix with examples on the first axis; targets may be class indices (Vector, rank-1 tensor) or one-hot rows (Matrix, rank-2 tensor).

Constructors

Constructor Summary
UnsupervisedMetaLearnAlgorithm(UnsupervisedMetaLearnOptions<T, TInput, TOutput> options)

Properties

Property Summary
MetaLearningAlgorithmType AlgorithmType { get; }

Methods

Method Summary
IModel<TInput, TOutput, ModelMetadata<T>> Adapt(IMetaLearningTask<T, TInput, TOutput> task)
T MetaTrain(TaskBatch<T, TInput, TOutput> taskBatch)