From 2135803a7e8b7ab768a10a94004c7ce473b3d8a8 Mon Sep 17 00:00:00 2001 From: DanielAvdar <66269169+DanielAvdar@users.noreply.github.com> Date: Tue, 30 Jan 2024 10:46:08 +0200 Subject: [PATCH] optimized tests imports statements, unused imports removed. --- tests/checks/check_automl_with_regression.py | 11 ++--------- tests/checks/run_ml_tests.py | 2 -- tests/checks/run_performance_tests.py | 2 -- tests/tests_algorithms/test_baseline.py | 9 ++------- tests/tests_algorithms/test_catboost.py | 9 +++------ tests/tests_algorithms/test_decision_tree.py | 11 +++-------- tests/tests_algorithms/test_extra_trees.py | 9 ++------- tests/tests_algorithms/test_factory.py | 5 ----- tests/tests_algorithms/test_knn.py | 7 +------ tests/tests_algorithms/test_lightgbm.py | 6 ++---- tests/tests_algorithms/test_linear.py | 9 ++------- tests/tests_algorithms/test_nn.py | 7 ++----- tests/tests_algorithms/test_random_forest.py | 9 ++------- tests/tests_algorithms/test_registry.py | 4 ---- tests/tests_algorithms/test_xgboost.py | 11 ++++------- tests/tests_automl/test_adjust_validation.py | 7 ++----- tests/tests_automl/test_automl_time_constraints.py | 13 +++---------- tests/tests_automl/test_data_types.py | 10 +++------- tests/tests_automl/test_dir_change.py | 7 ++----- tests/tests_automl/test_golden_features.py | 12 +++++------- .../tests_automl/test_models_needed_for_predict.py | 7 ++----- tests/tests_automl/test_restore.py | 11 ++++------- tests/tests_automl/test_targets.py | 11 ++++------- tests/tests_automl/test_update_errors_report.py | 7 ++----- .../tests_callbacks/test_total_time_constraint.py | 7 +------ tests/tests_fairness/test_binary_classification.py | 5 +---- .../test_multi_class_classification.py | 5 +---- tests/tests_fairness/test_regression.py | 5 +---- tests/tests_preprocessing/disable_eda.py | 6 ++---- .../test_categorical_integers.py | 4 ++-- .../test_datetime_transformer.py | 4 +--- .../tests_preprocessing/test_encoding_selector.py | 4 ++-- tests/tests_preprocessing/test_exclude_missing.py | 3 ++- .../test_goldenfeatures_transformer.py | 14 +++++++------- tests/tests_preprocessing/test_label_binarizer.py | 4 ++-- tests/tests_preprocessing/test_label_encoder.py | 4 ++-- tests/tests_preprocessing/test_loo_encoder.py | 3 +-- tests/tests_preprocessing/test_preprocessing.py | 9 +++------ .../test_preprocessing_missing.py | 4 ++-- .../test_preprocessing_utils.py | 2 ++ tests/tests_preprocessing/test_scale.py | 3 +-- tests/tests_preprocessing/test_text_transformer.py | 4 +--- tests/tests_tuner/test_hill_climbing.py | 2 +- tests/tests_tuner/test_time_controller.py | 3 ++- tests/tests_tuner/test_tuner.py | 2 +- .../tests_utils/test_compute_additional_metrics.py | 10 ++-------- tests/tests_utils/test_importance.py | 5 +++-- tests/tests_utils/test_learning_curves.py | 1 + tests/tests_utils/test_metric.py | 2 +- tests/tests_utils/test_shap.py | 1 + tests/tests_utils/test_subsample.py | 5 ++--- tests/tests_validation/test_validator_kfold.py | 5 +++-- tests/tests_validation/test_validator_split.py | 5 +++-- 53 files changed, 106 insertions(+), 221 deletions(-) diff --git a/tests/checks/check_automl_with_regression.py b/tests/checks/check_automl_with_regression.py index 4fbc217c..adc866bb 100644 --- a/tests/checks/check_automl_with_regression.py +++ b/tests/checks/check_automl_with_regression.py @@ -1,16 +1,9 @@ import unittest -import tempfile -import json -import numpy as np + import pandas as pd +import sklearn.model_selection -from numpy.testing import assert_almost_equal -from sklearn import datasets from supervised.automl import AutoML -from supervised.metric import Metric - -import sklearn.model_selection -from sklearn.metrics import log_loss class AutoMLWithRegressionTest(unittest.TestCase): diff --git a/tests/checks/run_ml_tests.py b/tests/checks/run_ml_tests.py index 3c60d4f1..0c36e6d9 100644 --- a/tests/checks/run_ml_tests.py +++ b/tests/checks/run_ml_tests.py @@ -1,5 +1,3 @@ -import os -import sys import unittest from tests.tests_bin_class.run import * diff --git a/tests/checks/run_performance_tests.py b/tests/checks/run_performance_tests.py index 16449c2c..1afb870b 100644 --- a/tests/checks/run_performance_tests.py +++ b/tests/checks/run_performance_tests.py @@ -1,5 +1,3 @@ -import os -import sys import unittest from tests.tests_bin_class.test_performance import * diff --git a/tests/tests_algorithms/test_baseline.py b/tests/tests_algorithms/test_baseline.py index 51b915ee..162fb4a7 100644 --- a/tests/tests_algorithms/test_baseline.py +++ b/tests/tests_algorithms/test_baseline.py @@ -1,9 +1,6 @@ -import unittest -import tempfile -import json -import numpy as np import os -import pandas as pd +import tempfile +import unittest from numpy.testing import assert_almost_equal from sklearn import datasets @@ -14,8 +11,6 @@ ) from supervised.utils.metric import Metric -import tempfile - class BaselineTest(unittest.TestCase): @classmethod diff --git a/tests/tests_algorithms/test_catboost.py b/tests/tests_algorithms/test_catboost.py index 2526f2c2..6068a824 100644 --- a/tests/tests_algorithms/test_catboost.py +++ b/tests/tests_algorithms/test_catboost.py @@ -1,16 +1,13 @@ -import unittest +import os import tempfile -import json -import copy -import numpy as np +import unittest + import pandas as pd -import os from numpy.testing import assert_almost_equal from sklearn import datasets from supervised.algorithms.catboost import CatBoostAlgorithm, additional from supervised.utils.metric import Metric -import tempfile additional["max_rounds"] = 1 diff --git a/tests/tests_algorithms/test_decision_tree.py b/tests/tests_algorithms/test_decision_tree.py index 639a88e7..c7c60ffc 100644 --- a/tests/tests_algorithms/test_decision_tree.py +++ b/tests/tests_algorithms/test_decision_tree.py @@ -1,20 +1,15 @@ -import unittest -import tempfile -import json -import numpy as np -import pandas as pd import os +import tempfile +import unittest + from numpy.testing import assert_almost_equal from sklearn import datasets from supervised.algorithms.decision_tree import ( - DecisionTreeAlgorithm, DecisionTreeRegressorAlgorithm, ) from supervised.utils.metric import Metric -import tempfile - class DecisionTreeTest(unittest.TestCase): @classmethod diff --git a/tests/tests_algorithms/test_extra_trees.py b/tests/tests_algorithms/test_extra_trees.py index 3d0a0cc8..c83458fa 100644 --- a/tests/tests_algorithms/test_extra_trees.py +++ b/tests/tests_algorithms/test_extra_trees.py @@ -1,9 +1,6 @@ -import unittest -import tempfile -import json -import numpy as np -import pandas as pd import os +import tempfile +import unittest from numpy.testing import assert_almost_equal from sklearn import datasets @@ -16,8 +13,6 @@ ) from supervised.utils.metric import Metric -import tempfile - additional["trees_in_step"] = 1 regression_additional["trees_in_step"] = 1 additional["max_steps"] = 1 diff --git a/tests/tests_algorithms/test_factory.py b/tests/tests_algorithms/test_factory.py index f822f395..5b7de411 100644 --- a/tests/tests_algorithms/test_factory.py +++ b/tests/tests_algorithms/test_factory.py @@ -1,11 +1,6 @@ import unittest -import tempfile -import json -import numpy as np -import pandas as pd from supervised.algorithms.factory import AlgorithmFactory - from supervised.algorithms.xgboost import XgbAlgorithm diff --git a/tests/tests_algorithms/test_knn.py b/tests/tests_algorithms/test_knn.py index 3e4119be..a0c9098c 100644 --- a/tests/tests_algorithms/test_knn.py +++ b/tests/tests_algorithms/test_knn.py @@ -1,17 +1,12 @@ import unittest -import tempfile -import json -import numpy as np -import pandas as pd +import numpy as np from numpy.testing import assert_almost_equal from sklearn import datasets from supervised.algorithms.knn import KNeighborsAlgorithm, KNeighborsRegressorAlgorithm from supervised.utils.metric import Metric -import tempfile - class KNeighborsRegressorAlgorithmTest(unittest.TestCase): @classmethod diff --git a/tests/tests_algorithms/test_lightgbm.py b/tests/tests_algorithms/test_lightgbm.py index 0d637680..cc166631 100644 --- a/tests/tests_algorithms/test_lightgbm.py +++ b/tests/tests_algorithms/test_lightgbm.py @@ -1,8 +1,6 @@ -import unittest -import tempfile -import json -import copy import os +import tempfile +import unittest import numpy as np import pandas as pd diff --git a/tests/tests_algorithms/test_linear.py b/tests/tests_algorithms/test_linear.py index a243f7c3..550f7b97 100644 --- a/tests/tests_algorithms/test_linear.py +++ b/tests/tests_algorithms/test_linear.py @@ -1,9 +1,6 @@ -import unittest -import tempfile -import json -import numpy as np -import pandas as pd import os +import tempfile +import unittest from numpy.testing import assert_almost_equal from sklearn import datasets @@ -11,8 +8,6 @@ from supervised.algorithms.linear import LinearAlgorithm, LinearRegressorAlgorithm from supervised.utils.metric import Metric -import tempfile - class LinearRegressorAlgorithmTest(unittest.TestCase): @classmethod diff --git a/tests/tests_algorithms/test_nn.py b/tests/tests_algorithms/test_nn.py index eebcf9a5..ea09cdab 100644 --- a/tests/tests_algorithms/test_nn.py +++ b/tests/tests_algorithms/test_nn.py @@ -1,9 +1,6 @@ -import unittest -import tempfile -import json -import numpy as np -import pandas as pd import os +import tempfile +import unittest from numpy.testing import assert_almost_equal from sklearn import datasets diff --git a/tests/tests_algorithms/test_random_forest.py b/tests/tests_algorithms/test_random_forest.py index 9a83f389..3fd266e2 100644 --- a/tests/tests_algorithms/test_random_forest.py +++ b/tests/tests_algorithms/test_random_forest.py @@ -1,10 +1,7 @@ -import unittest +import os import tempfile -import json -import numpy as np -import pandas as pd +import unittest -import os from numpy.testing import assert_almost_equal from sklearn import datasets @@ -16,8 +13,6 @@ ) from supervised.utils.metric import Metric -import tempfile - additional["trees_in_step"] = 1 regression_additional["trees_in_step"] = 1 additional["max_steps"] = 1 diff --git a/tests/tests_algorithms/test_registry.py b/tests/tests_algorithms/test_registry.py index 7549fed3..7311a283 100644 --- a/tests/tests_algorithms/test_registry.py +++ b/tests/tests_algorithms/test_registry.py @@ -1,8 +1,4 @@ import unittest -import tempfile -import json -import numpy as np -import pandas as pd from supervised.algorithms.registry import AlgorithmsRegistry diff --git a/tests/tests_algorithms/test_xgboost.py b/tests/tests_algorithms/test_xgboost.py index 11923bed..0053ab5e 100644 --- a/tests/tests_algorithms/test_xgboost.py +++ b/tests/tests_algorithms/test_xgboost.py @@ -1,18 +1,15 @@ -import unittest +import os import tempfile -import json +import unittest + import numpy as np import pandas as pd -import os - from numpy.testing import assert_almost_equal from sklearn import datasets from supervised.algorithms.xgboost import XgbAlgorithm, additional -from supervised.utils.metric import Metric from supervised.utils.constants import BINARY_CLASSIFICATION - -import tempfile +from supervised.utils.metric import Metric additional["max_rounds"] = 1 diff --git a/tests/tests_automl/test_adjust_validation.py b/tests/tests_automl/test_adjust_validation.py index 3a0d2592..83fc4b8b 100644 --- a/tests/tests_automl/test_adjust_validation.py +++ b/tests/tests_automl/test_adjust_validation.py @@ -1,13 +1,10 @@ import os +import shutil import unittest -import tempfile -import json + import numpy as np -import pandas as pd -import shutil from supervised import AutoML -from supervised.exceptions import AutoMLException class AutoMLAdjustValidationTest(unittest.TestCase): diff --git a/tests/tests_automl/test_automl_time_constraints.py b/tests/tests_automl/test_automl_time_constraints.py index 442b10e8..20d99312 100644 --- a/tests/tests_automl/test_automl_time_constraints.py +++ b/tests/tests_automl/test_automl_time_constraints.py @@ -1,15 +1,8 @@ -import os -import unittest -import tempfile -import json -import time -import numpy as np -import pandas as pd import shutil +import time +import unittest + from supervised import AutoML -from numpy.testing import assert_almost_equal -from sklearn import datasets -from supervised.exceptions import AutoMLException from supervised.tuner.time_controller import TimeController diff --git a/tests/tests_automl/test_data_types.py b/tests/tests_automl/test_data_types.py index 6c4108bd..5ba3a14e 100644 --- a/tests/tests_automl/test_data_types.py +++ b/tests/tests_automl/test_data_types.py @@ -1,14 +1,10 @@ -import os +import shutil import unittest -import tempfile -import json + import numpy as np import pandas as pd -import shutil + from supervised import AutoML -from numpy.testing import assert_almost_equal -from sklearn import datasets -from supervised.exceptions import AutoMLException class AutoMLDataTypesTest(unittest.TestCase): diff --git a/tests/tests_automl/test_dir_change.py b/tests/tests_automl/test_dir_change.py index fab2c110..1b85e074 100644 --- a/tests/tests_automl/test_dir_change.py +++ b/tests/tests_automl/test_dir_change.py @@ -1,15 +1,12 @@ import os -import json import shutil import unittest -import tempfile + import numpy as np -import pandas as pd -from sklearn import datasets from numpy.testing import assert_almost_equal +from sklearn import datasets from supervised import AutoML -from supervised.exceptions import AutoMLException class AutoMLDirChangeTest(unittest.TestCase): diff --git a/tests/tests_automl/test_golden_features.py b/tests/tests_automl/test_golden_features.py index a401435a..6b82e8b1 100644 --- a/tests/tests_automl/test_golden_features.py +++ b/tests/tests_automl/test_golden_features.py @@ -1,14 +1,12 @@ +import json import os +import shutil import unittest -import tempfile -import json -import numpy as np + import pandas as pd -import shutil -from supervised import AutoML -from numpy.testing import assert_almost_equal from sklearn import datasets -from supervised.exceptions import AutoMLException + +from supervised import AutoML class AutoMLGoldenFeaturesTest(unittest.TestCase): diff --git a/tests/tests_automl/test_models_needed_for_predict.py b/tests/tests_automl/test_models_needed_for_predict.py index ee41a802..56297983 100644 --- a/tests/tests_automl/test_models_needed_for_predict.py +++ b/tests/tests_automl/test_models_needed_for_predict.py @@ -1,10 +1,7 @@ +import json import os -import unittest import tempfile -import json -import numpy as np -import pandas as pd -import shutil +import unittest from supervised import AutoML from supervised.exceptions import AutoMLException diff --git a/tests/tests_automl/test_restore.py b/tests/tests_automl/test_restore.py index a8f46a0a..9eeee0fc 100644 --- a/tests/tests_automl/test_restore.py +++ b/tests/tests_automl/test_restore.py @@ -1,15 +1,12 @@ +import json import os +import shutil import unittest -import tempfile -import json + import numpy as np import pandas as pd -import shutil -from supervised import AutoML -from numpy.testing import assert_almost_equal -from sklearn import datasets -from supervised.exceptions import AutoMLException +from supervised import AutoML from supervised.algorithms.xgboost import additional additional["max_rounds"] = 1 diff --git a/tests/tests_automl/test_targets.py b/tests/tests_automl/test_targets.py index 3bd18c39..1b0e545a 100644 --- a/tests/tests_automl/test_targets.py +++ b/tests/tests_automl/test_targets.py @@ -1,15 +1,12 @@ -import os +import shutil import unittest -import json + import numpy as np import pandas as pd -import shutil -from supervised import AutoML -from numpy.testing import assert_almost_equal -from sklearn import datasets -from supervised.exceptions import AutoMLException +from supervised import AutoML from supervised.algorithms.xgboost import additional +from supervised.exceptions import AutoMLException additional["max_rounds"] = 1 diff --git a/tests/tests_automl/test_update_errors_report.py b/tests/tests_automl/test_update_errors_report.py index 302e2d5f..0c4622e8 100644 --- a/tests/tests_automl/test_update_errors_report.py +++ b/tests/tests_automl/test_update_errors_report.py @@ -1,13 +1,10 @@ import os +import shutil import unittest -import tempfile -import json + import numpy as np -import pandas as pd -import shutil from supervised import AutoML -from supervised.exceptions import AutoMLException class AutoMLUpdateErrorsReportTest(unittest.TestCase): diff --git a/tests/tests_callbacks/test_total_time_constraint.py b/tests/tests_callbacks/test_total_time_constraint.py index 37dffaa3..ee3156c8 100644 --- a/tests/tests_callbacks/test_total_time_constraint.py +++ b/tests/tests_callbacks/test_total_time_constraint.py @@ -1,11 +1,6 @@ -import unittest -import tempfile -import json import time -import numpy as np -import pandas as pd +import unittest -from numpy.testing import assert_almost_equal from supervised.callbacks.total_time_constraint import TotalTimeConstraint from supervised.exceptions import NotTrainedException diff --git a/tests/tests_fairness/test_binary_classification.py b/tests/tests_fairness/test_binary_classification.py index 7ff63c1a..6458a8ff 100644 --- a/tests/tests_fairness/test_binary_classification.py +++ b/tests/tests_fairness/test_binary_classification.py @@ -1,11 +1,8 @@ -import os import shutil import unittest + import numpy as np import pandas as pd -from supervised.utils.utils import dump_data -from supervised.validation.validator_kfold import KFoldValidator -import shutil from supervised import AutoML diff --git a/tests/tests_fairness/test_multi_class_classification.py b/tests/tests_fairness/test_multi_class_classification.py index 2609203d..3dab884f 100644 --- a/tests/tests_fairness/test_multi_class_classification.py +++ b/tests/tests_fairness/test_multi_class_classification.py @@ -1,11 +1,8 @@ -import os import shutil import unittest + import numpy as np import pandas as pd -from supervised.utils.utils import dump_data -from supervised.validation.validator_kfold import KFoldValidator -import shutil from supervised import AutoML diff --git a/tests/tests_fairness/test_regression.py b/tests/tests_fairness/test_regression.py index bbcb81fc..45922e16 100644 --- a/tests/tests_fairness/test_regression.py +++ b/tests/tests_fairness/test_regression.py @@ -1,11 +1,8 @@ -import os import shutil import unittest + import numpy as np import pandas as pd -from supervised.utils.utils import dump_data -from supervised.validation.validator_kfold import KFoldValidator -import shutil from supervised import AutoML diff --git a/tests/tests_preprocessing/disable_eda.py b/tests/tests_preprocessing/disable_eda.py index a0ecd320..6f6564f9 100644 --- a/tests/tests_preprocessing/disable_eda.py +++ b/tests/tests_preprocessing/disable_eda.py @@ -1,11 +1,9 @@ import os -import re +import shutil import unittest -import tempfile -import json + import numpy as np import pandas as pd -import shutil from sklearn import datasets from supervised import AutoML diff --git a/tests/tests_preprocessing/test_categorical_integers.py b/tests/tests_preprocessing/test_categorical_integers.py index 7b8c7f19..950def9d 100644 --- a/tests/tests_preprocessing/test_categorical_integers.py +++ b/tests/tests_preprocessing/test_categorical_integers.py @@ -1,7 +1,7 @@ import unittest -import tempfile -import numpy as np + import pandas as pd + from supervised.preprocessing.preprocessing_categorical import PreprocessingCategorical diff --git a/tests/tests_preprocessing/test_datetime_transformer.py b/tests/tests_preprocessing/test_datetime_transformer.py index b6ef35c3..f808d2f7 100644 --- a/tests/tests_preprocessing/test_datetime_transformer.py +++ b/tests/tests_preprocessing/test_datetime_transformer.py @@ -1,7 +1,5 @@ import unittest -import tempfile -import json -import numpy as np + import pandas as pd from supervised.preprocessing.datetime_transformer import DateTimeTransformer diff --git a/tests/tests_preprocessing/test_encoding_selector.py b/tests/tests_preprocessing/test_encoding_selector.py index 4fd98c8d..3dd13131 100644 --- a/tests/tests_preprocessing/test_encoding_selector.py +++ b/tests/tests_preprocessing/test_encoding_selector.py @@ -1,7 +1,7 @@ import unittest -import tempfile -import numpy as np + import pandas as pd + from supervised.preprocessing.encoding_selector import EncodingSelector from supervised.preprocessing.preprocessing_categorical import PreprocessingCategorical diff --git a/tests/tests_preprocessing/test_exclude_missing.py b/tests/tests_preprocessing/test_exclude_missing.py index 8c99ce45..729317da 100644 --- a/tests/tests_preprocessing/test_exclude_missing.py +++ b/tests/tests_preprocessing/test_exclude_missing.py @@ -1,7 +1,8 @@ import unittest -import tempfile + import numpy as np import pandas as pd + from supervised.preprocessing.exclude_missing_target import ExcludeRowsMissingTarget diff --git a/tests/tests_preprocessing/test_goldenfeatures_transformer.py b/tests/tests_preprocessing/test_goldenfeatures_transformer.py index 21180f98..0385ff73 100644 --- a/tests/tests_preprocessing/test_goldenfeatures_transformer.py +++ b/tests/tests_preprocessing/test_goldenfeatures_transformer.py @@ -1,19 +1,19 @@ -import unittest -import tempfile -import json import shutil +import tempfile +import unittest + import numpy as np import pandas as pd -from numpy.testing import assert_almost_equal from sklearn import datasets -from supervised.preprocessing.goldenfeatures_transformer import ( - GoldenFeaturesTransformer, -) + from supervised.algorithms.registry import ( BINARY_CLASSIFICATION, MULTICLASS_CLASSIFICATION, REGRESSION, ) +from supervised.preprocessing.goldenfeatures_transformer import ( + GoldenFeaturesTransformer, +) class GoldenFeaturesTransformerTest(unittest.TestCase): diff --git a/tests/tests_preprocessing/test_label_binarizer.py b/tests/tests_preprocessing/test_label_binarizer.py index f3e42351..337c72d6 100644 --- a/tests/tests_preprocessing/test_label_binarizer.py +++ b/tests/tests_preprocessing/test_label_binarizer.py @@ -1,6 +1,6 @@ -import unittest -import tempfile import json +import unittest + import numpy as np import pandas as pd diff --git a/tests/tests_preprocessing/test_label_encoder.py b/tests/tests_preprocessing/test_label_encoder.py index 8813ca38..f59db24c 100644 --- a/tests/tests_preprocessing/test_label_encoder.py +++ b/tests/tests_preprocessing/test_label_encoder.py @@ -1,6 +1,6 @@ -import unittest -import tempfile import json +import unittest + import numpy as np import pandas as pd diff --git a/tests/tests_preprocessing/test_loo_encoder.py b/tests/tests_preprocessing/test_loo_encoder.py index 5650dac5..77b316fe 100644 --- a/tests/tests_preprocessing/test_loo_encoder.py +++ b/tests/tests_preprocessing/test_loo_encoder.py @@ -1,6 +1,5 @@ import unittest -import tempfile -import json + import numpy as np import pandas as pd from numpy.testing import assert_almost_equal diff --git a/tests/tests_preprocessing/test_preprocessing.py b/tests/tests_preprocessing/test_preprocessing.py index df8d5a2f..498b45b5 100644 --- a/tests/tests_preprocessing/test_preprocessing.py +++ b/tests/tests_preprocessing/test_preprocessing.py @@ -1,14 +1,11 @@ -import json -import copy import unittest -import tempfile + import numpy as np import pandas as pd -import uuid -from supervised.preprocessing.preprocessing_missing import PreprocessingMissingValues -from supervised.preprocessing.preprocessing_categorical import PreprocessingCategorical from supervised.preprocessing.preprocessing import Preprocessing +from supervised.preprocessing.preprocessing_categorical import PreprocessingCategorical +from supervised.preprocessing.preprocessing_missing import PreprocessingMissingValues class PreprocessingTest(unittest.TestCase): diff --git a/tests/tests_preprocessing/test_preprocessing_missing.py b/tests/tests_preprocessing/test_preprocessing_missing.py index 88bc709f..e96dd7c6 100644 --- a/tests/tests_preprocessing/test_preprocessing_missing.py +++ b/tests/tests_preprocessing/test_preprocessing_missing.py @@ -1,8 +1,8 @@ import unittest -import tempfile + import numpy as np import pandas as pd -from supervised.preprocessing.preprocessing_utils import PreprocessingUtils + from supervised.preprocessing.preprocessing_missing import PreprocessingMissingValues diff --git a/tests/tests_preprocessing/test_preprocessing_utils.py b/tests/tests_preprocessing/test_preprocessing_utils.py index 33109cf8..5217effd 100644 --- a/tests/tests_preprocessing/test_preprocessing_utils.py +++ b/tests/tests_preprocessing/test_preprocessing_utils.py @@ -1,6 +1,8 @@ import unittest + import numpy as np import pandas as pd + from supervised.preprocessing.preprocessing_utils import PreprocessingUtils diff --git a/tests/tests_preprocessing/test_scale.py b/tests/tests_preprocessing/test_scale.py index 5a117346..d859e2c7 100644 --- a/tests/tests_preprocessing/test_scale.py +++ b/tests/tests_preprocessing/test_scale.py @@ -1,6 +1,5 @@ import unittest -import tempfile -import json + import numpy as np import pandas as pd from numpy.testing import assert_almost_equal diff --git a/tests/tests_preprocessing/test_text_transformer.py b/tests/tests_preprocessing/test_text_transformer.py index f59105ba..25191024 100644 --- a/tests/tests_preprocessing/test_text_transformer.py +++ b/tests/tests_preprocessing/test_text_transformer.py @@ -1,7 +1,5 @@ import unittest -import tempfile -import json -import numpy as np + import pandas as pd from numpy.testing import assert_almost_equal diff --git a/tests/tests_tuner/test_hill_climbing.py b/tests/tests_tuner/test_hill_climbing.py index f1bc57f3..e0a3da38 100644 --- a/tests/tests_tuner/test_hill_climbing.py +++ b/tests/tests_tuner/test_hill_climbing.py @@ -1,5 +1,5 @@ -import os import unittest + from supervised.tuner.mljar_tuner import MljarTuner diff --git a/tests/tests_tuner/test_time_controller.py b/tests/tests_tuner/test_time_controller.py index f277bd08..2373b5bb 100644 --- a/tests/tests_tuner/test_time_controller.py +++ b/tests/tests_tuner/test_time_controller.py @@ -1,7 +1,8 @@ -import os import time import unittest + from numpy.testing import assert_almost_equal + from supervised.tuner.time_controller import TimeController diff --git a/tests/tests_tuner/test_tuner.py b/tests/tests_tuner/test_tuner.py index f6258429..e7a0b11e 100644 --- a/tests/tests_tuner/test_tuner.py +++ b/tests/tests_tuner/test_tuner.py @@ -1,5 +1,5 @@ -import os import unittest + from supervised.tuner.mljar_tuner import MljarTuner diff --git a/tests/tests_utils/test_compute_additional_metrics.py b/tests/tests_utils/test_compute_additional_metrics.py index 2d0140d1..dd278656 100644 --- a/tests/tests_utils/test_compute_additional_metrics.py +++ b/tests/tests_utils/test_compute_additional_metrics.py @@ -1,15 +1,9 @@ import unittest -import tempfile -import json -import numpy as np -import pandas as pd -from numpy.testing import assert_almost_equal -from sklearn import datasets +import numpy as np -from supervised.utils.additional_metrics import AdditionalMetrics -from supervised.utils.metric import Metric from supervised.algorithms.registry import BINARY_CLASSIFICATION, REGRESSION +from supervised.utils.additional_metrics import AdditionalMetrics class ComputeAdditionalMetricsTest(unittest.TestCase): diff --git a/tests/tests_utils/test_importance.py b/tests/tests_utils/test_importance.py index b4a9bc81..97a26971 100644 --- a/tests/tests_utils/test_importance.py +++ b/tests/tests_utils/test_importance.py @@ -1,10 +1,11 @@ import os +import tempfile import unittest + import numpy as np import pandas as pd -import tempfile - from xgboost import XGBClassifier + from supervised.utils.importance import PermutationImportance diff --git a/tests/tests_utils/test_learning_curves.py b/tests/tests_utils/test_learning_curves.py index 7f7de823..6424230d 100644 --- a/tests/tests_utils/test_learning_curves.py +++ b/tests/tests_utils/test_learning_curves.py @@ -1,5 +1,6 @@ import os import unittest + from supervised.utils.learning_curves import LearningCurves diff --git a/tests/tests_utils/test_metric.py b/tests/tests_utils/test_metric.py index ff257fc5..25a22183 100644 --- a/tests/tests_utils/test_metric.py +++ b/tests/tests_utils/test_metric.py @@ -1,6 +1,6 @@ import unittest + import numpy as np -import pandas as pd from numpy.testing import assert_almost_equal from supervised.utils.metric import Metric diff --git a/tests/tests_utils/test_shap.py b/tests/tests_utils/test_shap.py index 6003d785..a1110553 100644 --- a/tests/tests_utils/test_shap.py +++ b/tests/tests_utils/test_shap.py @@ -1,4 +1,5 @@ import unittest + import numpy as np import pandas as pd diff --git a/tests/tests_utils/test_subsample.py b/tests/tests_utils/test_subsample.py index 956886fa..ac38924a 100644 --- a/tests/tests_utils/test_subsample.py +++ b/tests/tests_utils/test_subsample.py @@ -1,11 +1,10 @@ -import os import unittest + import numpy as np import pandas as pd -import tempfile -from supervised.utils.subsample import subsample from supervised.algorithms.registry import REGRESSION +from supervised.utils.subsample import subsample class SubsampleTest(unittest.TestCase): diff --git a/tests/tests_validation/test_validator_kfold.py b/tests/tests_validation/test_validator_kfold.py index a7083c46..42f4c5c4 100644 --- a/tests/tests_validation/test_validator_kfold.py +++ b/tests/tests_validation/test_validator_kfold.py @@ -1,11 +1,12 @@ import os -import shutil +import tempfile import unittest + import numpy as np import pandas as pd + from supervised.utils.utils import dump_data from supervised.validation.validator_kfold import KFoldValidator -import tempfile class KFoldValidatorTest(unittest.TestCase): diff --git a/tests/tests_validation/test_validator_split.py b/tests/tests_validation/test_validator_split.py index 3de0698b..1d7eed6f 100644 --- a/tests/tests_validation/test_validator_split.py +++ b/tests/tests_validation/test_validator_split.py @@ -1,11 +1,12 @@ import os -import shutil +import tempfile import unittest + import numpy as np import pandas as pd + from supervised.utils.utils import dump_data from supervised.validation.validator_split import SplitValidator -import tempfile class SplitValidatorTest(unittest.TestCase):