From 0d3b503c468c758502185c581bdb5a41a317964e Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 2 May 2024 10:54:35 +0200 Subject: [PATCH] :sparkles: Move test from pimms to njab --- src/njab/sklearn/__init__.py | 6 +++--- test/test_sklearn.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 test/test_sklearn.py diff --git a/src/njab/sklearn/__init__.py b/src/njab/sklearn/__init__.py index 8cc2aa6..e145258 100644 --- a/src/njab/sklearn/__init__.py +++ b/src/njab/sklearn/__init__.py @@ -8,13 +8,13 @@ import pandas as pd import sklearn import sklearn.model_selection - from mrmr import mrmr_classif -from .types import Splits, ResultsSplit, Results, AucRocCurve, PrecisionRecallCurve +from . import scoring from .pca import run_pca from .preprocessing import StandardScaler -from . import scoring +from .types import (AucRocCurve, PrecisionRecallCurve, Results, ResultsSplit, + Splits) __all__ = [ 'run_model', diff --git a/test/test_sklearn.py b/test/test_sklearn.py new file mode 100644 index 0000000..24d5dfe --- /dev/null +++ b/test/test_sklearn.py @@ -0,0 +1,12 @@ +import numpy as np +import numpy.testing as npt +import pandas as pd +import sklearn.preprocessing as preprocessing + +from njab.sklearn.preprocessing import StandardScaler + + +def test_StandardScaler(): + X = pd.DataFrame(np.array([[2, None], [3, 2], [4, 6]])) + npt.assert_almost_equal(preprocessing.StandardScaler().fit(X).transform(X), + StandardScaler().fit(X).transform(X).to_numpy())