TIMAlgorithm<T, TInput, TOutput>

Models & Types · AiDotNet.MetaLearning.Algorithms

Implementation of TIM (Transductive Information Maximization) for few-shot learning.

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

For Beginners

TIM lets query examples help classify each other:

The key insight: If you’re classifying 15 query examples into 5 classes, you know each class should get roughly 3 examples. TIM uses this constraint along with confidence maximization to iteratively refine predictions.

How it works:

  1. Start with initial predictions (e.g., nearest centroid from support set)
  2. Iteratively refine by optimizing:
  • Each query should be confidently assigned to ONE class (low conditional entropy)
  • Classes should be balanced overall (high marginal entropy)
  • Don’t deviate too far from initial predictions
  1. After convergence, output the refined predictions

Why it works: By processing queries together, TIM avoids “lonely” misclassifications. If most queries near a centroid say “class A”, the outlier gets pulled in too.

How It Works

TIM is a transductive few-shot method that refines query predictions by maximizing mutual information between features and predicted labels. It processes all query examples jointly, using the query set’s structure for better classification.

Algorithm - TIM:

Reference: Boudiaf, M., Ziko, I., Rony, J., Dolz, J., Piantanida, P., & Ben Ayed, I. (2020). Information Maximization for Few-Shot Learning. NeurIPS 2020.

Constructors

Constructor Summary
TIMAlgorithm(TIMOptions<T, TInput, TOutput> options) Initializes a new TIM meta-learner.

Properties

Property Summary
MetaLearningAlgorithmType AlgorithmType { get; }

Methods

Method Summary
IModel<TInput, TOutput, ModelMetadata<T>> Adapt(IMetaLearningTask<T, TInput, TOutput> task) Adapts to a new task using transductive information maximization.
T MetaTrain(TaskBatch<T, TInput, TOutput> taskBatch) Performs one meta-training step for TIM.