ThresholdClipper<T>

Models & Types · AiDotNet.Preprocessing.OutlierHandling

Clips values based on explicit threshold bounds.

Inheritance: TransformerBase<T, Matrix<T>, Matrix<T>> → ThresholdClipper<T>

For Beginners

This is the simplest outlier clipper - you tell it exactly what the minimum and maximum allowed values are, and it clips anything outside those bounds. This is useful when you know from domain knowledge what the valid range should be.

How It Works

ThresholdClipper clips values to user-specified lower and upper bounds. Unlike other clippers that compute bounds from data statistics, this clipper uses explicit thresholds provided by the user.

Use Cases:

  • Domain-specific constraints (e.g., percentages must be 0-100)
  • Physical limits (e.g., temperatures can’t be below absolute zero)
  • Business rules (e.g., prices must be positive)
  • Known valid ranges from domain expertise

Constructors

Constructor Summary
ThresholdClipper(double lowerThreshold, double upperThreshold, int[] columnIndices) Creates a new instance of ThresholdClipper with explicit bounds.
ThresholdClipper(double threshold, int[] columnIndices) Creates a new instance of ThresholdClipper with symmetric bounds.

Properties

Property Summary
bool SupportsInverseTransform { get; } Gets whether this transformer supports inverse transformation.
double LowerThreshold { get; } Gets the lower threshold bound.
double UpperThreshold { get; } Gets the upper threshold bound.

Methods

Method Summary
ValueTuple<int[], int[]> CountOutliers(Matrix<T> data) Counts how many values would be clipped at each bound.
bool[] GetOutlierMask(Matrix<T> data) Gets a boolean mask indicating which values are outside the threshold bounds.
string[] GetFeatureNamesOut(string[] inputFeatureNames) Gets the output feature names after transformation.