Table of Contents

Class DistillationStrategyFactory<T>

Namespace
AiDotNet.KnowledgeDistillation
Assembly
AiDotNet.dll

Factory for creating distillation strategies from enums and configurations.

public static class DistillationStrategyFactory<T>

Type Parameters

T

The numeric type for calculations.

Inheritance
DistillationStrategyFactory<T>
Inherited Members

Methods

Configure(DistillationStrategyType)

Creates a strategy with custom parameters using a fluent builder pattern.

public static DistillationStrategyFactory<T>.StrategyBuilder Configure(DistillationStrategyType strategyType)

Parameters

strategyType DistillationStrategyType

Returns

DistillationStrategyFactory<T>.StrategyBuilder

CreateStrategy(DistillationStrategyType, double, double, double?, double?, ContrastiveMode?, Vector<string>?, Vector<string>?, Vector<IDistillationStrategy<T>>?, Vector<double>?)

Creates a distillation strategy from the specified type and parameters.

public static IDistillationStrategy<T> CreateStrategy(DistillationStrategyType strategyType, double temperature = 3, double alpha = 0.3, double? featureWeight = null, double? attentionWeight = null, ContrastiveMode? contrastiveMode = null, Vector<string>? featureLayerPairs = null, Vector<string>? attentionLayers = null, Vector<IDistillationStrategy<T>>? strategies = null, Vector<double>? strategyWeights = null)

Parameters

strategyType DistillationStrategyType

The type of strategy to create.

temperature double

Softmax temperature (default 3.0).

alpha double

Weight for hard loss vs soft loss (default 0.3).

featureWeight double?

Weight for feature matching loss (for feature-based strategies).

attentionWeight double?

Weight for attention matching loss (for attention-based strategies).

contrastiveMode ContrastiveMode?

Mode for contrastive loss (for contrastive strategies).

featureLayerPairs Vector<string>

Layer pairs for feature matching (for feature-based).

attentionLayers Vector<string>

Attention layers to match (for attention-based).

strategies Vector<IDistillationStrategy<T>>

Vector of strategies to combine (for hybrid).

strategyWeights Vector<double>

Weights for combined strategies (for hybrid).

Returns

IDistillationStrategy<T>

A configured distillation strategy.