Table of Contents

Class MissingIndicator<T>

Namespace
AiDotNet.Preprocessing.Imputers
Assembly
AiDotNet.dll

Creates binary indicator features for missing values.

public class MissingIndicator<T> : TransformerBase<T, Matrix<T>, Matrix<T>>, IDataTransformer<T, Matrix<T>, Matrix<T>>

Type Parameters

T

The numeric type for calculations (e.g., float, double).

Inheritance
TransformerBase<T, Matrix<T>, Matrix<T>>
MissingIndicator<T>
Implements
IDataTransformer<T, Matrix<T>, Matrix<T>>
Inherited Members

Remarks

MissingIndicator transforms a dataset by adding binary columns that indicate where values were missing. This is useful when the fact that a value is missing is itself informative for the model.

For Beginners: Sometimes knowing that data is missing is important: - A missing income might mean someone declined to answer (high income?) - A missing medical test might mean the doctor didn't think it was necessary

This transformer adds new columns (one per feature) with 1 where data was missing and 0 where it was present.

Constructors

MissingIndicator(MissingIndicatorFeatures, double, int[]?)

Creates a new instance of MissingIndicator<T>.

public MissingIndicator(MissingIndicatorFeatures features = MissingIndicatorFeatures.MissingOnly, double missingValue = NaN, int[]? columnIndices = null)

Parameters

features MissingIndicatorFeatures

Which features to create indicators for. Defaults to MissingOnly.

missingValue double

The value to treat as missing. Defaults to NaN.

columnIndices int[]

The column indices to check, or null for all columns.

Properties

Features

Gets which features to create indicators for.

public MissingIndicatorFeatures Features { get; }

Property Value

MissingIndicatorFeatures

FeaturesWithMissing

Gets the indices of features that had missing values during fit.

public int[]? FeaturesWithMissing { get; }

Property Value

int[]

SupportsInverseTransform

Gets whether this transformer supports inverse transformation.

public override bool SupportsInverseTransform { get; }

Property Value

bool

Methods

FitCore(Matrix<T>)

Identifies which features have missing values.

protected override void FitCore(Matrix<T> data)

Parameters

data Matrix<T>

The training data matrix.

GetFeatureNamesOut(string[]?)

Gets the output feature names after transformation.

public override string[] GetFeatureNamesOut(string[]? inputFeatureNames = null)

Parameters

inputFeatureNames string[]

Returns

string[]

InverseTransformCore(Matrix<T>)

Inverse transformation is not supported.

protected override Matrix<T> InverseTransformCore(Matrix<T> data)

Parameters

data Matrix<T>

Returns

Matrix<T>

TransformCore(Matrix<T>)

Creates binary indicator features for missing values.

protected override Matrix<T> TransformCore(Matrix<T> data)

Parameters

data Matrix<T>

The data to transform.

Returns

Matrix<T>

Binary indicators for missing values.