Wrapper classes
Ver. 1.3.0 (2025-07-23)
This module contains the abstract root class for all scikit-learn wrapper classes.
Learn more: https://scikit-learn.org
- class mlpro_int_sklearn.wrappers.basics.WrapperSklearn(p_logging=True)
Bases:
WrapperRoot class for all scikit-learn wrapper classes.
- C_TYPE = 'Wrapper scikit-learn'
- C_WRAPPED_PACKAGE: str = 'scikit-learn'
- C_MINIMUM_VERSION: str = '1.6.1'
- C_SCIREF_TYPE = 'Online'
- C_SCIREF_AUTHOR = 'scikit-learn community'
- C_SCIREF_URL = 'https://scikit-learn.org'
Wrappers for data streams
Ver. 1.7.0 (2025-07-23)
This module provides wrapper functionalities to incorporate public data sets of the scikit-learn ecosystem.
Learn more: https://scikit-learn.org/stable/api/sklearn.datasets.html
- class mlpro_int_sklearn.wrappers.streams.WrStreamProviderSklearn(p_logging=True)
Bases:
WrapperSklearn,StreamProviderWrapper class for Sklearn as StreamProvider.
- C_NAME = 'scikit-learn'
- _load_utils = ['fetch_20newsgroups()', 'fetch_20newsgroups_vectorized(as_frame=True)', 'fetch_california_housing()', 'fetch_covtype()', 'fetch_rcv1()', 'fetch_kddcup99()', 'load_diabetes()', 'load_iris()', 'load_breast_cancer()', 'load_wine()']
- _data_utils = ['clear_data_home', 'dump_svmlight_file']
- _datasets = ['20newsgroups', '20newsgroups_vectorized', 'california_housing', 'covtype', 'rcv1', 'kddcup99', 'diabetes', 'iris', 'breast_cancer', 'wine']
- _get_stream_list(p_mode=0, p_logging=True, **p_kwargs) list
Custom class to get alist of stream objects from Sklearn
- Returns:
list_streams – Returns a list of Streams in Sklearn
- Return type:
List
- _get_stream(p_id: str = None, p_name: str = None, p_mode=0, p_logging=True, **p_kwargs) Stream
Custom class to fetch an Sklearn stream object.
- Parameters:
p_id (str) – Optional Id of the requested stream. Default = None.
p_name (str) – Optional name of the requested stream. Default = None.
p_mode – Operation mode. Default: Mode.C_MODE_SIM.
p_logging – Log level (see constants of class Log). Default: Log.C_LOG_ALL.
p_kwargs (dict) – Further stream specific parameters.
- Returns:
s – Stream object or None in case of an error.
- Return type:
Stream
Wrapper for anomaly detectors
Ver. 2.4.0 (2025-07-23)
This module provides wrapper root classes from Scikit-learn to MLPro, specifically for anomaly detectors.
Learn more: https://scikit-learn.org/stable/modules/outlier_detection.html
- class mlpro_int_sklearn.wrappers.anomalydetectors.basics.WrAnomalyDetectorSklearn2MLPro(p_algo_scikit_learn: OutlierMixin, p_range_max=1, p_duplicate_data=False, p_visualize=False, p_logging=True, p_anomaly_buffer_size=100, p_instance_buffer_size: int = 20, p_detection_steprate: int = 1, p_group_anomaly_det: bool = True, **p_kwargs)
Bases:
AnomalyDetectorIBPG,WrapperSklearnMLPro’s wrapper for anomaly detectors of the scikit-learn project. The wrapper is limited to detectors of type ‘OutlierMixin’ providing the method fit_predict() for a mixed data training/prediction.
- Parameters:
p_algo_scikit_learn (OutlierMixin) – Outlier algorithm from the scikit-learn framework to be wrapped
p_range_max (int) – Maximum range of asynchonicity. See class Range. Default is Range.C_RANGE_PROCESS.
p_duplicate_data (bool) – If True, instances will be duplicated before processing. Default = False.
p_visualize (bool) – Boolean switch for visualisation. Default = False.
p_logging (int = Log.C_LOG_ALL) – Log level (see constants of class Log). Default: Log.C_LOG_ALL
p_anomaly_buffer_size (int = 100) – Size of the internal anomaly buffer self.anomalies. Default = 100.
p_instance_buffer_size (int = 20) – Number of instances to be buffered internally as the basis for anomaly detection. Default = 20.
p_detection_steprate (int = 1) – Detection steprate in the interval [1,p_instance_buffer_size].
p_group_anomaly_det (bool) – Paramter to activate group anomaly detection. Default is True.
Notes
- Supported algorithms
LOF - Local Outlier Factor
IF - Isolation Forest
Elliptic Envelope
Further ones inherited from ‘OutlierMixin’
- Additional features
Optional group anomaly detection
2D/3D anomaly visualization
- Supported types of anomalies
PointAnomaly
GroupAnomaly
- C_TYPE = 'Anomaly Detector (scikit-learn)'
- _detect(p_instance: Instance, **p_kwargs)
Custom method for the main detection algorithm. Use the _raise_change_event() method to raise a change detected by your algorithm.
- Parameters:
p_instance (Instance) – Instance that triggered the detection.
**p_kwargs – Optional keyword arguments (originally provided to the constructor).