logai.algorithms.categorical_encoding_algo package
Submodules
logai.algorithms.categorical_encoding_algo.label_encoding module
- class logai.algorithms.categorical_encoding_algo.label_encoding.LabelEncoding
Bases:
CategoricalEncodingAlgo
This is a wrapper class for LabelEncoder from scikit-learn library. For more details see https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.LabelEncoder.html.
- fit_transform(log_attributes: DataFrame)
Fits and transforms log_attributes into label encoding categories.
- Parameters:
log_attributes – A list of log attributes in text format.
- Returns:
The label encoding categories.
logai.algorithms.categorical_encoding_algo.one_hot_encoding module
- class logai.algorithms.categorical_encoding_algo.one_hot_encoding.OneHotEncoding(params: OneHotEncodingParams)
Bases:
CategoricalEncodingAlgo
This is a wrapper class for OneHotEncoder from scikit-learn library https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html.
- fit_transform(log_attributes: DataFrame) DataFrame
Fits and transforms log attributes into one-hot encoding categories.
- Parameters:
log_attributes – A list of log attributes in text form.
- Returns:
A pandas dataframe of categories in on-hot encoding.
- class logai.algorithms.categorical_encoding_algo.one_hot_encoding.OneHotEncodingParams
Bases:
Config
Configuration for One-Hot Encoding. For more details on the parameters see https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html.
- Parameters:
categories – Categories (unique values) per feature.
drop – Specifies a methodology to use to drop one of the categories per feature.
dtype – Desired dtype of output.
handle_unknown – Specifies the way unknown categories are handled during transform.
- categories: str = 'auto'
- drop: object = None
- dtype
alias of
float64
- handle_unknown: str = 'error'
logai.algorithms.categorical_encoding_algo.ordinal_encoding module
- class logai.algorithms.categorical_encoding_algo.ordinal_encoding.OrdinalEncoding(params: OrdinalEncodingParams)
Bases:
CategoricalEncodingAlgo
Implementation of ordinal encoder. This is a wrapper class for the OrdinalEncoder from scikit learn https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OrdinalEncoder.html.
- fit_transform(log_attributes: DataFrame) DataFrame
Fits and transforms log attributes into ordinal encoding categories.
- Parameters:
log_attributes – A list of log attributes in text format.
- Returns:
A pandas dataframe of ordinal encoding categories.
- class logai.algorithms.categorical_encoding_algo.ordinal_encoding.OrdinalEncodingParams(categories: str = 'auto', dtype: ~numpy.float64 = <class 'numpy.float64'>, handle_unknown: str = 'error', unknown_value: object | None = None)
Bases:
Config
Configuration of OrdinalEncoding. For more details on the parameters see https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OrdinalEncoder.html.
- Parameters:
categories – Categories (unique values) per feature.
dtype – Desired dtype of output.
handle_unknown – Specifies the way unknown categories are handled during transform.
unknown_value – When the parameter handle_unknown is set to ‘use_encoded_value’, this parameter is required and will set the encoded value of unknown categories.
- categories: str
- dtype: float64
- handle_unknown: str
- unknown_value: object