Skip to content

Commit

Permalink
upgrade python and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahmish committed Mar 15, 2024
1 parent 020629f commit 4ff341d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 20 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions cardea/data_loader/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys

import networkx as nx
import numpy as np
import pandas as pd
from numpy import nan

Expand Down Expand Up @@ -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',
Expand Down
21 changes: 17 additions & 4 deletions cardea/modeling/modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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)

Expand Down
10 changes: 6 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]

Expand Down Expand Up @@ -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={
Expand All @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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]
Expand Down

0 comments on commit 4ff341d

Please sign in to comment.