Skip to content

Commit

Permalink
optimized tests imports statements, unused imports removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielAvdar committed Jan 30, 2024
1 parent 36cdb43 commit 2135803
Show file tree
Hide file tree
Showing 53 changed files with 106 additions and 221 deletions.
11 changes: 2 additions & 9 deletions tests/checks/check_automl_with_regression.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 0 additions & 2 deletions tests/checks/run_ml_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os
import sys
import unittest

from tests.tests_bin_class.run import *
Expand Down
2 changes: 0 additions & 2 deletions tests/checks/run_performance_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os
import sys
import unittest

from tests.tests_bin_class.test_performance import *
Expand Down
9 changes: 2 additions & 7 deletions tests/tests_algorithms/test_baseline.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,8 +11,6 @@
)
from supervised.utils.metric import Metric

import tempfile


class BaselineTest(unittest.TestCase):
@classmethod
Expand Down
9 changes: 3 additions & 6 deletions tests/tests_algorithms/test_catboost.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
11 changes: 3 additions & 8 deletions tests/tests_algorithms/test_decision_tree.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 2 additions & 7 deletions tests/tests_algorithms/test_extra_trees.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions tests/tests_algorithms/test_factory.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
7 changes: 1 addition & 6 deletions tests/tests_algorithms/test_knn.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 2 additions & 4 deletions tests/tests_algorithms/test_lightgbm.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 2 additions & 7 deletions tests/tests_algorithms/test_linear.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
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.linear import LinearAlgorithm, LinearRegressorAlgorithm
from supervised.utils.metric import Metric

import tempfile


class LinearRegressorAlgorithmTest(unittest.TestCase):
@classmethod
Expand Down
7 changes: 2 additions & 5 deletions tests/tests_algorithms/test_nn.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 2 additions & 7 deletions tests/tests_algorithms/test_random_forest.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tests/tests_algorithms/test_registry.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import unittest
import tempfile
import json
import numpy as np
import pandas as pd

from supervised.algorithms.registry import AlgorithmsRegistry

Expand Down
11 changes: 4 additions & 7 deletions tests/tests_algorithms/test_xgboost.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 2 additions & 5 deletions tests/tests_automl/test_adjust_validation.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
13 changes: 3 additions & 10 deletions tests/tests_automl/test_automl_time_constraints.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
10 changes: 3 additions & 7 deletions tests/tests_automl/test_data_types.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
7 changes: 2 additions & 5 deletions tests/tests_automl/test_dir_change.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
12 changes: 5 additions & 7 deletions tests/tests_automl/test_golden_features.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
7 changes: 2 additions & 5 deletions tests/tests_automl/test_models_needed_for_predict.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 4 additions & 7 deletions tests/tests_automl/test_restore.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 4 additions & 7 deletions tests/tests_automl/test_targets.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Loading

0 comments on commit 2135803

Please sign in to comment.