watex.transformers.CategorizeFeatures#

class watex.transformers.CategorizeFeatures(num_columns_properties=None)[source]#

Transform numerical features into categorical features and return a new array transformed.

Parameters

*num_columns_properties* (list) – list composed ofnumerical features name, list of features boundaries with their categorized names.

Notes

From the boundaries values including, features values can be transformed. num_columns_properties is composed of:

  • feature name or index equals to ‘flow`’ or index of flow =’12’

  • features boundaries equals to [0., 1., 3] may correspond to:

    • 0: features flow values with equal to 0. By default the begining

      value like 0 is unranged.

    • 0-1: replace values ranged between 0 and 1.

    • 1-3:replace values ranged between 1-3

    • >3get all values greater than 3. by default categorize values

      greater than the last values.

    If the default classification is not suitable, create your own range

    values like [[0-1], [1-3], 3] (1)

  • categorized names: Be sure that if the value is provided as without

    ranging like (1). The number of categorized values must be the size of the features boundaries +1. For instance, we try to replace all numerical values in column flow by

    -FR0 : all fllow egal to 0.
    -FR1: flow between 0-1
    -FR2: flow between 1-3
    -FR3: flow greater than 3.
    

    As you can see the features boundaries [0., 1., 3]size is equal to `categorized name`[‘FR0’, ‘FR1’, ‘FR2’, ‘FR3’] size +1.