Table of Contents

Enum RelationAggregationMethod

Namespace
AiDotNet.Enums
Assembly
AiDotNet.dll

Methods for aggregating multiple relation scores in Relation Networks.

public enum RelationAggregationMethod

Fields

Attention = 2

Use attention-weighted average.

Computes attention weights to weight each support example's contribution.

For Beginners: This gives more weight to more relevant examples. If some support examples are more similar to the query, their scores count more.

LearnedWeighting = 3

Use learned weighting.

Learns a neural network to weight the contribution of each support example.

For Beginners: Instead of using fixed rules (mean, max), the network learns the best way to combine scores during training. This is the most flexible but requires more data to learn the weighting.

Max = 1

Use maximum score.

Takes the highest relation score among all support examples.

For Beginners: This picks the best match. If a query looks very similar to even ONE example of a class, that class gets a high score. Useful when class examples are diverse.

Mean = 0

Compute mean of all scores.

Simply averages all relation scores for a class.

For Beginners: This is the simplest approach - just average all the similarity scores. If a query is similar to most examples of a class, it will get a high average score for that class.

Remarks

When there are multiple support examples per class, we need a way to combine the relation scores from comparing a query with each support example.

For Beginners: In few-shot learning, each class has several example images. When classifying a new query image, we compare it to ALL examples of each class. This enum controls how those multiple similarity scores are combined into a single score for each class.

For example, if we have 5 dog examples and compare a query to each:

  • Mean: Average all 5 scores
  • Max: Take the highest score (most similar dog example)
  • Attention: Weight scores by relevance
  • LearnedWeighting: Let the network learn optimal weights