MetaLearningTaskBase<T, TInput, TOutput>

Base Classes · AiDotNet.Data.Structures

Abstract base class for meta-learning tasks, providing common functionality and validation.

Implements: IMetaLearningTask<T, TInput, TOutput>

How It Works

This base class implements the IMetaLearningTask interface and provides common functionality for all meta-learning task implementations. It includes validation, default values, and helper methods to reduce code duplication across concrete implementations.

Concrete implementations should inherit from this class and provide any additional functionality specific to their meta-learning scenario (e.g., episode tracking, hierarchical relationships, continual learning).

Properties

Property Summary
Dictionary<string, object> Metadata { get; } Gets the additional metadata about the task.
TInput QueryInput { get; set; } Gets or sets the input features for the query set.
TInput QuerySetX { get; } Gets the input features for the query set (alias for QueryInput).
TInput SupportInput { get; set; } Gets or sets the input features for the support set.
TInput SupportSetX { get; } Gets the input features for the support set (alias for SupportInput).
TOutput QueryOutput { get; set; } Gets or sets the target labels for the query set.
TOutput QuerySetY { get; } Gets the target labels for the query set (alias for QueryOutput).
TOutput SupportOutput { get; set; } Gets or sets the target labels for the support set.
TOutput SupportSetY { get; } Gets the target labels for the support set (alias for SupportOutput).
int NumQueryPerClass { get; set; } Gets the number of query examples per class.
int NumShots { get; set; } Gets the number of shots (examples per class) in the support set.
int NumWays { get; set; } Gets the number of ways (classes) in this task.
int? TaskId { get; set; } Gets or sets an optional identifier for the task.
string Name { get; set; } Gets or sets an optional name or identifier for the task.

Methods

Method Summary
bool TryGetMetadata(string key, TValue value) Gets a metadata value if it exists.
string ToString() Creates a string representation of the task.
void SetMetadata(string key, object value) Adds or updates a metadata entry.
void Validate() Validates that the task has all required data populated.