module feature_selection.ofs

Online Feature Selection Method.

This module contains the Online Feature Selection model based on a Perceptron, which was introduced by: WANG, Jialei, et al. Online feature selection and its applications. IEEE Transactions on knowledge and data engineering, 2013, 26. Jg., Nr. 3, S. 698-710.

Copyright (C) 2022 Johannes Haug.


class OFS

OFS feature selector.

This feature selector uses the weights of a Perceptron classifier.

method OFS.__init__

__init__(
    n_total_features: int,
    n_selected_features: int,
    reset_after_drift: bool = False,
    baseline: str = 'constant',
    ref_sample: Union[float, numpy._array_like._SupportsArray[numpy.dtype], numpy._nested_sequence._NestedSequence[numpy._array_like._SupportsArray[numpy.dtype]], bool, int, complex, str, bytes, numpy._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]] = 0
)

Inits the feature selector.

Args:

  • n_total_features: The total number of features.
  • n_selected_features: The number of selected features.
  • reset_after_drift: A boolean indicating if the change detector will be reset after a drift was detected.
  • baseline: A string identifier of the baseline method. The baseline is the value that we substitute non-selected features with. This is necessary, because most online learning models are not able to handle arbitrary patterns of missing data.
  • ref_sample: A sample used to compute the baseline. If the constant baseline is used, one needs to provide a single float value.

method OFS.reset

reset()

Resets the feature selector.


method OFS.weight_features

weight_features(
    X: Union[numpy._array_like._SupportsArray[numpy.dtype], numpy._nested_sequence._NestedSequence[numpy._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]],
    y: Union[numpy._array_like._SupportsArray[numpy.dtype], numpy._nested_sequence._NestedSequence[numpy._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]]
)

Updates feature weights.

Args:

  • X: Array/matrix of observations.
  • y: Array of corresponding labels.

This file was automatically generated via lazydocs.