niaaml.preprocessing
- class niaaml.preprocessing.PreprocessingAlgorithm(**kwargs)
Bases:
PipelineComponent
Class for implementing preprocessing algorithms.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- See Also:
niaaml.pipeline_component.PipelineComponent
niaaml.preprocessing.feature_selection
- class niaaml.preprocessing.feature_selection.BatAlgorithm(**kwargs)
Bases:
FeatureSelectionAlgorithm
Implementation of feature selection using BA algorithm.
- Date:
2020
- Author:
Luka Pečnik
- Reference:
The implementation is adapted according to the following article: D. Fister, I. Fister, T. Jagrič, I. Fister Jr., J. Brest. A novel self-adaptive differential evolution for feature selection using threshold mechanism . In: Proceedings of the 2018 IEEE Symposium on Computational Intelligence (SSCI 2018), pp. 17-24, 2018.
- Reference URL:
- License:
MIT
- See Also:
- Name = 'Bat Algorithm'
- select_features(x, y, **kwargs)
Perform the feature selection process.
- Arguments:
x (pandas.core.frame.DataFrame): Array of original features. y (pandas.core.series.Series) Expected classifier results.
- Returns:
pandas.core.frame.DataFrame: Mask of selected features.
- set_parameters(**kwargs)
Set the parameters/arguments of the algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- class niaaml.preprocessing.feature_selection.DifferentialEvolution(**kwargs)
Bases:
FeatureSelectionAlgorithm
Implementation of feature selection using DE algorithm.
- Date:
2020
- Author:
Luka Pečnik
- Reference:
The implementation is adapted according to the following article: D. Fister, I. Fister, T. Jagrič, I. Fister Jr., J. Brest. A novel self-adaptive differential evolution for feature selection using threshold mechanism . In: Proceedings of the 2018 IEEE Symposium on Computational Intelligence (SSCI 2018), pp. 17-24, 2018.
- Reference URL:
- License:
MIT
- See Also:
- Name = 'Differential Evolution'
- select_features(x, y, **kwargs)
Perform the feature selection process.
- Arguments:
x (pandas.core.frame.DataFrame): Array of original features. y (pandas.core.series.Series) Expected classifier results.
- Returns:
numpy.ndarray[bool]: Mask of selected features.
- set_parameters(**kwargs)
Set the parameters/arguments of the algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- class niaaml.preprocessing.feature_selection.FeatureSelectionAlgorithm(**kwargs)
Bases:
PreprocessingAlgorithm
Class for implementing feature selection algorithms.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- See Also:
- select_features(x, y, **kwargs)
Perform the feature selection process.
- Arguments:
x (pandas.core.frame.DataFrame): Array of original features. y (pandas.core.series.Series) Expected classifier results.
- Returns:
numpy.ndarray[bool]: Mask of selected features.
- class niaaml.preprocessing.feature_selection.FeatureSelectionAlgorithmFactory(**kwargs)
Bases:
Factory
Class with string mappings to feature selection algorithms.
- Attributes:
_entities (Dict[str, FeatureSelectionAlgorithm]): Mapping from strings to feature selection algorithms.
- See Also:
niaaml.utilities.Factory
- class niaaml.preprocessing.feature_selection.GreyWolfOptimizer(**kwargs)
Bases:
FeatureSelectionAlgorithm
Implementation of feature selection using GWO algorithm.
- Date:
2020
- Author:
Luka Pečnik
- Reference:
The implementation is adapted according to the following article: D. Fister, I. Fister, T. Jagrič, I. Fister Jr., J. Brest. A novel self-adaptive differential evolution for feature selection using threshold mechanism . In: Proceedings of the 2018 IEEE Symposium on Computational Intelligence (SSCI 2018), pp. 17-24, 2018.
- Reference URL:
- License:
MIT
- See Also:
- Name = 'Grey Wolf Optimizer'
- select_features(x, y, **kwargs)
Perform the feature selection process.
- Arguments:
x (pandas.core.frame.DataFrame): Array of original features. y (pandas.core.series.Series) Expected classifier results.
- Returns:
numpy.ndarray[bool]: Mask of selected features.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- class niaaml.preprocessing.feature_selection.ParticleSwarmOptimization(**kwargs)
Bases:
FeatureSelectionAlgorithm
Implementation of feature selection using PSO algorithm.
- Date:
2020
- Author:
Luka Pečnik
- Reference:
The implementation is adapted according to the following article: D. Fister, I. Fister, T. Jagrič, I. Fister Jr., J. Brest. A novel self-adaptive differential evolution for feature selection using threshold mechanism . In: Proceedings of the 2018 IEEE Symposium on Computational Intelligence (SSCI 2018), pp. 17-24, 2018.
- Reference URL:
- License:
MIT
- See Also:
- Name = 'Particle Swarm Optimization'
- select_features(x, y, **kwargs)
Perform the feature selection process.
- Arguments:
x (pandas.core.frame.DataFrame): Array of original features. y (pandas.core.series.Series) Expected classifier results.
- Returns:
numpy.ndarray[bool]: Mask of selected features.
- set_parameters(**kwargs)
Set the parameters/arguments of the algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- class niaaml.preprocessing.feature_selection.SelectKBest(**kwargs)
Bases:
FeatureSelectionAlgorithm
Implementation of feature selection using selection of k best features according to used score function.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Documentation:
https://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.SelectKBest.html
- See Also:
- Name = 'Select K Best'
- select_features(x, y, **kwargs)
Perform the feature selection process.
- Arguments:
x (pandas.core.frame.DataFrame): Array of original features. y (pandas.core.series.Series) Expected classifier results.
- Returns:
numpy.ndarray[bool]: Mask of selected features.
- set_parameters(**kwargs)
Set the parameters/arguments of the algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- class niaaml.preprocessing.feature_selection.SelectPercentile(**kwargs)
Bases:
FeatureSelectionAlgorithm
Implementation of feature selection using percentile selection of best features according to used score function.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Documentation:
https://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.SelectPercentile.html
- See Also:
- Name = 'Select Percentile'
- select_features(x, y, **kwargs)
Perform the feature selection process.
- Arguments:
x (pandas.core.frame.DataFrame): Array of original features. y (pandas.core.series.Series) Expected classifier results.
- Returns:
numpy.ndarray[bool]: Mask of selected features.
- set_parameters(**kwargs)
Set the parameters/arguments of the algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- class niaaml.preprocessing.feature_selection.VarianceThreshold(**kwargs)
Bases:
FeatureSelectionAlgorithm
Implementation of feature selection using variance threshold.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Documentation:
https://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.VarianceThreshold.html
- See Also:
- Name = 'Variance Threshold'
- select_features(x, y, **kwargs)
Perform the feature selection process.
- Arguments:
x (pandas.core.frame.DataFrame): Array of original features. y (pandas.core.series.Series) Expected classifier results.
- Returns:
numpy.ndarray[bool]: Mask of selected features.
- set_parameters(**kwargs)
Set the parameters/arguments of the algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- class niaaml.preprocessing.feature_selection.jDEFSTH(**kwargs)
Bases:
FeatureSelectionAlgorithm
Implementation of self-adaptive differential evolution for feature selection using threshold mechanism.
- Date:
2020
- Author:
Iztok Fister Jr.
- Reference:
Fister, I. Fister, T. Jagrič, I. Fister Jr., J. Brest. A novel self-adaptive differential evolution for feature selection using threshold mechanism . In: Proceedings of the 2018 IEEE Symposium on Computational Intelligence (SSCI 2018), pp. 17-24, 2018.
- Reference URL:
- License:
MIT
- Name = 'Self-Adaptive Differential Evolution'
- select_features(x, y, **kwargs)
Perform the feature selection process.
- Arguments:
x (pandas.core.frame.DataFrame): Array of original features. y (pandas.core.series.Series) Expected classifier results.
- Returns:
numpy.ndarray[bool]: Mask of selected features.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
niaaml.preprocessing.feature_transform
- class niaaml.preprocessing.feature_transform.FeatureTransformAlgorithm(**kwargs)
Bases:
PreprocessingAlgorithm
Class for implementing feature transform algorithms.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- See Also:
- fit(x, **kwargs)
Fit implemented feature transform algorithm.
- Arguments:
x (pandas.core.frame.DataFrame): n samples to fit transformation algorithm.
- transform(x, **kwargs)
Transforms the given x data.
- Arguments:
x (pandas.core.frame.DataFrame): Data to transform.
- Returns:
pandas.core.frame.DataFrame: Transformed data.
- class niaaml.preprocessing.feature_transform.FeatureTransformAlgorithmFactory(**kwargs)
Bases:
Factory
Class with string mappings to feature transform algorithms.
- Attributes:
_entities (Dict[str, FeatureTransformAlgorithm]): Mapping from strings to feature transform algorithms.
- class niaaml.preprocessing.feature_transform.MaxAbsScaler(**kwargs)
Bases:
FeatureTransformAlgorithm
Implementation of feature scaling by its maximum absolute value.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Documentation:
- See Also:
- Name = 'Maximum Absolute Scaler'
- fit(x, **kwargs)
Fit implemented transformation algorithm.
- Arguments:
x (pandas.core.frame.DataFrame): n samples to fit transformation algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- transform(x, **kwargs)
Transforms the given x data.
- Arguments:
x (pandas.core.frame.DataFrame): Data to transform.
- Returns:
pandas.core.frame.DataFrame: Transformed data.
- class niaaml.preprocessing.feature_transform.Normalizer(**kwargs)
Bases:
FeatureTransformAlgorithm
Implementation of feature normalization algorithm.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Documentation:
https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.Normalizer
- See Also:
- Name = 'Normalizer'
- fit(x, **kwargs)
Fit implemented transformation algorithm.
- Arguments:
x (pandas.core.frame.DataFrame): n samples to fit transformation algorithm.
- set_parameters(**kwargs)
Set the parameters/arguments of the algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- transform(x, **kwargs)
Transforms the given x data.
- Arguments:
x (pandas.core.frame.DataFrame): Data to transform.
- Returns:
pandas.core.frame.DataFrame: Transformed data.
- class niaaml.preprocessing.feature_transform.QuantileTransformer(**kwargs)
Bases:
FeatureTransformAlgorithm
Implementation of quantile transformer.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Documentation:
- See Also:
- Name = 'Quantile Transformer'
- fit(x, **kwargs)
Fit implemented transformation algorithm.
- Arguments:
x (pandas.core.frame.DataFrame): n samples to fit transformation algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- transform(x, **kwargs)
Transforms the given x data.
- Arguments:
x (pandas.core.frame.DataFrame): Data to transform.
- Returns:
pandas.core.frame.DataFrame: Transformed data.
- class niaaml.preprocessing.feature_transform.RobustScaler(**kwargs)
Bases:
FeatureTransformAlgorithm
Implementation of the robust scaler.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Documentation:
- See Also:
- Name = 'Robust Scaler'
- fit(x, **kwargs)
Fit implemented transformation algorithm.
- Arguments:
x (pandas.core.frame.DataFrame): n samples to fit transformation algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- transform(x, **kwargs)
Transforms the given x data.
- Arguments:
x (pandas.core.frame.DataFrame): Data to transform.
- Returns:
pandas.core.frame.DataFrame: Transformed data.
- class niaaml.preprocessing.feature_transform.StandardScaler(**kwargs)
Bases:
FeatureTransformAlgorithm
Implementation of feature standard scaling algorithm.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Documentation:
https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html
- See Also:
- Name = 'Standard Scaler'
- fit(x, **kwargs)
Fit implemented transformation algorithm.
- Arguments:
x (pandas.core.frame.DataFrame): n samples to fit transformation algorithm.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- transform(x, **kwargs)
Transforms the given x data.
- Arguments:
x (pandas.core.frame.DataFrame): Data to transform.
- Returns:
pandas.core.frame.DataFrame: Transformed data.
niaaml.preprocessing.encoding
- class niaaml.preprocessing.encoding.EncoderFactory(**kwargs)
Bases:
Factory
Class with string mappings to encoders.
- Attributes:
_entities (Dict[str, FeatureEncoder]): Mapping from strings to encoders.
- See Also:
niaaml.utilities.Factory
- class niaaml.preprocessing.encoding.FeatureEncoder(**kwargs)
Bases:
object
Class for implementing feature encoders.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Attributes:
Name (str): Name of the feature encoder.
- Name = None
- fit(feature)
Fit feature encoder.
- Arguments:
feature (pandas.core.frame.DataFrame): A column (categorical) from DataFrame of features.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- transform(feature)
Transform feature’s values.
- Arguments:
feature (pandas.core.frame.DataFrame): A column (categorical) from DataFrame of features.
- Returns:
pandas.core.frame.DataFrame: A transformed column.
- class niaaml.preprocessing.encoding.OneHotEncoder(**kwargs)
Bases:
FeatureEncoder
Implementation of one-hot encoder.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Reference:
Seger, Cedric. “An investigation of categorical variable encoding techniques in machine learning: binary versus one-hot and feature hashing.” (2018).
- Documentation:
https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html
- See Also:
- Name = 'One-Hot Encoder'
- fit(feature)
Fit feature encoder.
- Arguments:
feature (pandas.core.frame.DataFrame): A column (categorical) from DataFrame of features.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- transform(feature)
Transform feature’s values.
- Arguments:
feature (pandas.core.frame.DataFrame): A column (categorical) from DataFrame of features.
- Returns:
pandas.core.frame.DataFrame: A transformed column.
- niaaml.preprocessing.encoding.encode_categorical_features(features, encoder)
Encode categorical features.
- Arguments:
features (pandas.core.frame.DataFrame): DataFrame of features. encoder (str): Name of the encoder to use.
- Returns:
- Tuple[pandas.core.frame.DataFrame, Iterable[FeatureEncoder]]:
Converted dataframe.
Dictionary of encoders for all categorical features.
niaaml.preprocessing.imputation
- class niaaml.preprocessing.imputation.Imputer(**kwargs)
Bases:
object
Class for implementing imputers.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Attributes:
Name (str): Name of the imputer.
- Name = None
- fit(feature)
Fit imputer.
- Arguments:
feature (pandas.core.frame.DataFrame): A column from DataFrame of features.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- transform(feature)
Transform feature’s values.
- Arguments:
feature (pandas.core.frame.DataFrame): A column from DataFrame of features.
- Returns:
pandas.core.frame.DataFrame: A transformed column.
- class niaaml.preprocessing.imputation.ImputerFactory(**kwargs)
Bases:
Factory
Class with string mappings to imputers.
- Attributes:
_entities (Dict[str, Imputer]): Mapping from strings to imputers.
- See Also:
niaaml.utilities.Factory
- class niaaml.preprocessing.imputation.SimpleImputer(**kwargs)
Bases:
Imputer
Implementation of simple imputer.
- Date:
2020
- Author:
Luka Pečnik
- License:
MIT
- Documentation:
https://scikit-learn.org/stable/modules/generated/sklearn.impute.SimpleImputer.html
- See Also:
- Name = 'Simple Imputer'
- fit(feature)
Fit imputer.
- Arguments:
feature (pandas.core.frame.DataFrame): A column from DataFrame of features.
- to_string()
User friendly representation of the object.
- Returns:
str: User friendly representation of the object.
- transform(feature)
Transform feature’s values.
- Arguments:
feature (pandas.core.frame.DataFrame): A column from DataFrame of features.
- Returns:
pandas.core.frame.DataFrame: A transformed column.
- niaaml.preprocessing.imputation.impute_features(features, imputer)
Impute features with missing data.
- Arguments:
features (pandas.core.frame.DataFrame): DataFrame of features. imputer (str): Name of the imputer to use.
- Returns:
- Tuple[pandas.core.frame.DataFrame, Dict[Imputer]]:
Converted dataframe.
Dictionary of imputers for all features with missing data.