From 38096cbf6fd79ebb56f3570f03076df9c142e04d Mon Sep 17 00:00:00 2001 From: detlefarend Date: Mon, 21 Jul 2025 18:54:26 +0200 Subject: [PATCH 1/2] Refact: API cleanup - Export lists __all__ Fixes #26 --- src/mlpro_int_sklearn/wrappers/streams.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mlpro_int_sklearn/wrappers/streams.py b/src/mlpro_int_sklearn/wrappers/streams.py index 8dad016..694a9e2 100644 --- a/src/mlpro_int_sklearn/wrappers/streams.py +++ b/src/mlpro_int_sklearn/wrappers/streams.py @@ -17,10 +17,11 @@ ## -- 2022-12-13 1.3.2 DA Bugfix ## -- 2023-06-09 1.4.0 DA Made the wrapper a sub-package ## -- 2024-02-16 1.5.0 DA Refactoring +## -- 2024-02-16 1.6.0 DA Refactoring ## ------------------------------------------------------------------------------------------------- """ -Ver. 1.5.0 (2024-02-16) +Ver. 1.6.0 (2025-7-16) This module provides wrapper functionalities to incorporate public data sets of the scikit-learn ecosystem. @@ -30,12 +31,16 @@ """ -from mlpro_int_sklearn.wrappers import WrapperSklearn -from mlpro.bf.streams import * -from mlpro.bf.math import * -from sklearn import datasets as sklearn_datasets import numpy +from sklearn import datasets as sklearn_datasets + +from mlpro.bf.ops import Mode +from mlpro.bf.math import * +from mlpro.bf.streams import * + +from mlpro_int_sklearn.wrappers import WrapperSklearn + From f964ae7c239f8da11d6de5b8770846476f380289 Mon Sep 17 00:00:00 2001 From: detlefarend Date: Wed, 23 Jul 2025 12:18:31 +0200 Subject: [PATCH 2/2] Refact: API cleanup - Export lists __all__ Fixes #26 --- .zenodo.json | 37 +++++++++++++++++++ src/mlpro_int_sklearn/__init__.py | 2 +- src/mlpro_int_sklearn/wrappers/__init__.py | 6 +-- .../wrappers/anomalydetectors/__init__.py | 2 +- .../wrappers/anomalydetectors/basics.py | 12 ++++-- src/mlpro_int_sklearn/wrappers/basics.py | 8 +++- src/mlpro_int_sklearn/wrappers/streams.py | 12 ++++-- ...ams_001_accessing_data_from_scikitlearn.py | 4 +- 8 files changed, 70 insertions(+), 13 deletions(-) create mode 100644 .zenodo.json diff --git a/.zenodo.json b/.zenodo.json new file mode 100644 index 0000000..8f98a67 --- /dev/null +++ b/.zenodo.json @@ -0,0 +1,37 @@ +{ + "title": "MLPro-Int-scikit-learn - Integration of scikit-learn into MLPro", + "description": "This repository provides wrapper classes that enable the use of selected scikit-learn functionalities in your MLPro applications.", + "creators": [ + { + "name": "Arend, Detlef", + "affiliation": "South Westphalia University of Applied Sciences, Germany", + "orcid": "0000-0002-8315-2346" + }, + { + "name": "Yuwono, Steve", + "affiliation": "South Westphalia University of Applied Sciences, Germany", + "orcid": "0000-0001-7570-2726" + }, + { + "name": "Kumar, Syamraj Purushamparambil Satheesh", + "affiliation": "South Westphalia University of Applied Sciences, Germany" + } + ], + "license": "Apache-2.0", + "upload_type": "software", + "keywords": [ + "online machine learning", + "Python", + "MLPro", + "scikit-learn", + "framework", + "open source" + ], + "communities": [ + { + "identifier": "mlpro" + } + ], + "language": "eng", + "access_right": "open" +} diff --git a/src/mlpro_int_sklearn/__init__.py b/src/mlpro_int_sklearn/__init__.py index 44a56bc..58517dc 100644 --- a/src/mlpro_int_sklearn/__init__.py +++ b/src/mlpro_int_sklearn/__init__.py @@ -1 +1 @@ -from mlpro_int_sklearn.wrappers import * \ No newline at end of file +from .wrappers import * \ No newline at end of file diff --git a/src/mlpro_int_sklearn/wrappers/__init__.py b/src/mlpro_int_sklearn/wrappers/__init__.py index f109dec..84c32dd 100644 --- a/src/mlpro_int_sklearn/wrappers/__init__.py +++ b/src/mlpro_int_sklearn/wrappers/__init__.py @@ -1,3 +1,3 @@ -from mlpro_int_sklearn.wrappers.basics import * -from mlpro_int_sklearn.wrappers.streams import * -from mlpro_int_sklearn.wrappers.anomalydetectors import * \ No newline at end of file +from .basics import * +from .streams import * +from .anomalydetectors import * \ No newline at end of file diff --git a/src/mlpro_int_sklearn/wrappers/anomalydetectors/__init__.py b/src/mlpro_int_sklearn/wrappers/anomalydetectors/__init__.py index 4e35d1e..e682b66 100644 --- a/src/mlpro_int_sklearn/wrappers/anomalydetectors/__init__.py +++ b/src/mlpro_int_sklearn/wrappers/anomalydetectors/__init__.py @@ -1 +1 @@ -from mlpro_int_sklearn.wrappers.anomalydetectors.basics import WrAnomalyDetectorSklearn2MLPro \ No newline at end of file +from .basics import * \ No newline at end of file diff --git a/src/mlpro_int_sklearn/wrappers/anomalydetectors/basics.py b/src/mlpro_int_sklearn/wrappers/anomalydetectors/basics.py index 698bd3b..839aa3a 100644 --- a/src/mlpro_int_sklearn/wrappers/anomalydetectors/basics.py +++ b/src/mlpro_int_sklearn/wrappers/anomalydetectors/basics.py @@ -19,10 +19,11 @@ ## -- 2025-05-30 2.2.0 DA/DS Alignment with MLPro 2.0.2 ## -- 2025-06-12 2.3.0 DA/DS - Alignment with MLPro 2.0.2 ## -- - Rework and optimization +## -- 2025-07-23 2.4.0 DA Refactoring ## ------------------------------------------------------------------------------------------------- """ -Ver. 2.3.0 (2025-06-12) +Ver. 2.4.0 (2025-07-23) This module provides wrapper root classes from Scikit-learn to MLPro, specifically for anomaly detectors. @@ -34,8 +35,7 @@ import numpy as np from sklearn.base import OutlierMixin -from mlpro.bf.various import Log -from mlpro.bf.exceptions import ParamError +from mlpro.bf import Log, ParamError from mlpro.bf.streams import StreamTask, Instance from mlpro.oa.streams.tasks.changedetectors.anomalydetectors.instancebased import AnomalyDetectorIBPG from mlpro.oa.streams.tasks.changedetectors.anomalydetectors.anomalies.instancebased import PointAnomaly @@ -44,6 +44,12 @@ +# Export list for public API +__all__ = [ 'WrAnomalyDetectorSklearn2MLPro' ] + + + + ## ------------------------------------------------------------------------------------------------- ## ------------------------------------------------------------------------------------------------- class WrAnomalyDetectorSklearn2MLPro (AnomalyDetectorIBPG, WrapperSklearn): diff --git a/src/mlpro_int_sklearn/wrappers/basics.py b/src/mlpro_int_sklearn/wrappers/basics.py index eeb70a1..93bd3ad 100644 --- a/src/mlpro_int_sklearn/wrappers/basics.py +++ b/src/mlpro_int_sklearn/wrappers/basics.py @@ -8,10 +8,11 @@ ## -- 2024-02-16 1.0.0 DA First version ## -- 2024-04-18 1.1.0 DA Alignment ot MLPro 1.4.0 ## -- 2025-03-05 1.2.0 DA Update of minimum release of scikit-learn to 1.6.1 +## -- 2025-07-23 1.3.0 DA Refactoring ## ------------------------------------------------------------------------------------------------- """ -Ver. 1.2.0 (2025-03-05) +Ver. 1.3.0 (2025-07-23) This module contains the abstract root class for all scikit-learn wrapper classes. @@ -25,6 +26,11 @@ +# Export list for public API +__all__ = [ 'WrapperSklearn' ] + + + ## ------------------------------------------------------------------------------------------------- ## ------------------------------------------------------------------------------------------------- diff --git a/src/mlpro_int_sklearn/wrappers/streams.py b/src/mlpro_int_sklearn/wrappers/streams.py index 694a9e2..dcab520 100644 --- a/src/mlpro_int_sklearn/wrappers/streams.py +++ b/src/mlpro_int_sklearn/wrappers/streams.py @@ -18,10 +18,11 @@ ## -- 2023-06-09 1.4.0 DA Made the wrapper a sub-package ## -- 2024-02-16 1.5.0 DA Refactoring ## -- 2024-02-16 1.6.0 DA Refactoring +## -- 2025-07-23 1.7.0 DA Refactoring ## ------------------------------------------------------------------------------------------------- """ -Ver. 1.6.0 (2025-7-16) +Ver. 1.7.0 (2025-07-23) This module provides wrapper functionalities to incorporate public data sets of the scikit-learn ecosystem. @@ -32,10 +33,10 @@ import numpy - from sklearn import datasets as sklearn_datasets -from mlpro.bf.ops import Mode +from mlpro.bf import Log, Mode +from mlpro.bf.various import ScientificObject from mlpro.bf.math import * from mlpro.bf.streams import * @@ -43,6 +44,11 @@ +# Export list for public API +__all__ = [ 'WrStreamProviderSklearn' ] + + + ## ------------------------------------------------------------------------------------------------- ## ------------------------------------------------------------------------------------------------- diff --git a/test/howtos/bf/howto_bf_streams_001_accessing_data_from_scikitlearn.py b/test/howtos/bf/howto_bf_streams_001_accessing_data_from_scikitlearn.py index 29627e0..eb1f0ca 100644 --- a/test/howtos/bf/howto_bf_streams_001_accessing_data_from_scikitlearn.py +++ b/test/howtos/bf/howto_bf_streams_001_accessing_data_from_scikitlearn.py @@ -32,8 +32,10 @@ """ +from datetime import datetime + from mlpro_int_sklearn import * -from mlpro.bf.various import Log +from mlpro.bf import Log