HyperShotAlgorithm<T, TInput, TOutput>

Models & Types · AiDotNet.MetaLearning.Algorithms

Implementation of HyperShot (kernel hypernetwork for few-shot learning).

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

Implements: IGeneratedParameterRegistrar<T>

For Beginners

HyperShot learns to create custom distance functions:

The insight: Different tasks need different ways to measure similarity. Comparing dog breeds requires looking at ear shape and size, while comparing bird species needs beak and plumage analysis. HyperShot generates the right comparison function for each task.

How it works:

  1. Extract features from the support set using a shared backbone
  2. Feed support features into a hypernetwork (a network that generates another network)
  3. The hypernetwork outputs kernel parameters that define how to measure similarity
  4. Use the generated kernel to compare query features against support prototypes

Why a hypernetwork? Instead of learning ONE fixed kernel that works for all tasks, HyperShot generates a CUSTOM kernel for each task, tailored to what makes the classes in that specific task different.

How It Works

HyperShot uses a hypernetwork to generate task-specific kernel parameters from the support set, enabling adaptive similarity computation for few-shot classification.

Algorithm - HyperShot:

Constructors

Constructor Summary
HyperShotAlgorithm(HyperShotOptions<T, TInput, TOutput> options) Initializes a new HyperShot meta-learner.

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)