diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d5fd59e1..8ea0db9c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,12 +11,12 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.6, 3.7] + python-version: ['3.8', '3.9', '3.10', '3.11'] os: [ubuntu-20.04, macos-latest] steps: - uses: actions/checkout@v1 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install package @@ -28,12 +28,12 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.6, 3.7] + python-version: ['3.8', '3.9', '3.10', '3.11'] os: [ubuntu-20.04, macos-latest] steps: - uses: actions/checkout@v1 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install package and dependencies @@ -45,12 +45,12 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.6, 3.7] + python-version: ['3.8', '3.9', '3.10', '3.11'] os: [ubuntu-20.04, macos-latest] steps: - uses: actions/checkout@v1 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install package and dependencies diff --git a/cardea/data_loader/data_loader.py b/cardea/data_loader/data_loader.py index e2ba959a..21665bfb 100644 --- a/cardea/data_loader/data_loader.py +++ b/cardea/data_loader/data_loader.py @@ -2,7 +2,6 @@ import sys import networkx as nx -import numpy as np import pandas as pd from numpy import nan @@ -126,9 +125,8 @@ def check_for_missing_values(self, entity_set, target_entity, column_name): """ if self.check_column_existence(entity_set, target_entity, column_name): - nat = np.datetime64('NaT') + # nat = np.datetime64('NaT') missings = [ - nat, nan, 'null', 'nan', diff --git a/cardea/modeling/modeler.py b/cardea/modeling/modeler.py index 68d48959..01a00900 100644 --- a/cardea/modeling/modeler.py +++ b/cardea/modeling/modeler.py @@ -4,7 +4,7 @@ import numpy as np import pandas as pd import sklearn -from btb.session import BTBSession +from baytune.session import BTBSession from mlblocks import MLPipeline from sklearn.model_selection import KFold, train_test_split @@ -32,8 +32,21 @@ class Modeler: 'Confusion Matrix': sklearn.metrics.confusion_matrix } + @staticmethod + def _load_pipeline(pipeline): + mlpipeline = MLPipeline(pipeline) + hyperparameters = pipeline.get_hyperparameters() + for primitive, values in hyperparameters.items(): + for hyperparam, value in values.items(): + if isinstance(value, list): + hyperparameters[primitive][hyperparam] = tuple(value) + + mlpipeline.set_hyperparameters(hyperparameters) + + return mlpipeline + def __init__(self, pipeline, problem_type): - self._pipeline = MLPipeline(pipeline) + self._pipeline = self._load_pipeline(pipeline) self._problem_type = problem_type @staticmethod @@ -97,7 +110,7 @@ def pipeline(self): MLPipeline: The pipeline in the modeler. """ - return MLPipeline(self._pipeline) + return self._load_pipeline(self._pipeline) def k_fold_validation(self, hyperparameters, X, y, scoring=None): """Score the pipeline through k-fold validation with the given scoring function. @@ -116,7 +129,7 @@ def k_fold_validation(self, hyperparameters, X, y, scoring=None): np.float64: The average score in the k-fold validation. """ - model_instance = MLPipeline(self._pipeline) + model_instance = self._load_pipeline(self._pipeline) X = pd.DataFrame(X) y = pd.Series(y) diff --git a/setup.py b/setup.py index 9a5a5620..c065818b 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ 'mlprimitives>=0.3.6.dev0,<0.5', 'baytune>=0.5,<0.6', 'pyCLI==2.0.3', - # 'scikit-learn>=0.21,<0.22', + 'scikit-learn>=1.2,<2', # 'featuretools>=0.20.0,<0.25', ] @@ -68,8 +68,10 @@ 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', ], description="Cardea", entry_points={ @@ -90,7 +92,7 @@ long_description_content_type='text/markdown', name='cardea', packages=find_packages(include=['cardea', 'cardea.*']), - python_requires='>=3.4', + python_requires='>=3.8,<3.12', setup_requires=setup_requires, test_suite='tests', tests_require=tests_require, diff --git a/tox.ini b/tox.ini index 6895ed00..becff058 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,13 @@ [tox] -envlist = py37, py36, lint, docs +envlist = py3{8,9,10,11}, lint, docs [travis] python = - 3.6: py36, lint, docs - 3.7: py37 + 3.8: py38, lint, docs + 3.9: py39 + 3.10: py310 + 3.11: py311 [testenv]