Binarizer<T>

Models & Types · AiDotNet.Preprocessing.Discretizers

Binarizes features based on a threshold value.

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

For Beginners

This transformer converts any values to just 0s and 1s:

  • If a value is above the threshold → 1
  • If a value is at or below the threshold → 0

Example with threshold=5: [3, 6, 2, 8, 5] → [0, 1, 0, 1, 0]

How It Works

Binarization transforms continuous values to binary (0 or 1) based on a threshold. Values greater than the threshold become 1, values less than or equal become 0.

Constructors

Constructor Summary
Binarizer(double threshold, int[] columnIndices) Creates a new instance of Binarizer with a custom threshold.
Binarizer(int[] columnIndices) Creates a new instance of Binarizer with a default threshold of 0.

Properties

Property Summary
T Threshold { get; } Gets the threshold value used for binarization.
bool SupportsInverseTransform { get; } Gets whether this transformer supports inverse transformation.

Methods

Method Summary
string[] GetFeatureNamesOut(string[] inputFeatureNames) Gets the output feature names after transformation.