Skip to content

Commit ba5d263

Browse files
authored
Merge pull request #433 from NannyML/chore/update-dependencies
Chore: the big bump
2 parents c6d326e + ded92d2 commit ba5d263

File tree

33 files changed

+5357
-4420
lines changed

33 files changed

+5357
-4420
lines changed

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
# The type of runner that the job will run on
2121
strategy:
2222
matrix:
23-
python-versions: ['3.8', '3.9', '3.10', '3.11']
23+
python-versions: ['3.9', '3.10', '3.11', '3.12']
2424
os: [ubuntu-20.04]
2525
# os: [ubuntu-18.04, macos-latest, windows-latest]
2626
runs-on: ${{ matrix.os }}

.github/workflows/preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
strategy:
2424
matrix:
25-
python-versions: [ 3.8 ]
25+
python-versions: [ 3.11 ]
2626

2727
steps:
2828
- uses: actions/checkout@v2

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
strategy:
2626
matrix:
27-
python-versions: [3.8]
27+
python-versions: [3.11]
2828

2929
# Steps represent a sequence of tasks that will be executed as part of the job
3030
steps:

nannyml/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import jinja2
1111
import yaml
12-
from pydantic import BaseModel, validator, Field
12+
from pydantic import BaseModel, Field, field_validator
1313

1414
from nannyml._typing import Self
1515
from nannyml.exceptions import IOException
@@ -71,7 +71,7 @@ class CalculatorConfig(BaseModel):
7171
store: Optional[StoreConfig] = Field(default=None)
7272
params: Dict[str, Any]
7373

74-
@validator('params')
74+
@field_validator('params')
7575
def _parse_thresholds(cls, value: Dict[str, Any]):
7676
"""Parse thresholds in params and convert them to :class:`Threshold`'s"""
7777
# Some calculators expect `thresholds` parameter as dict

nannyml/drift/ranker.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,11 @@ def rank(
372372
filtered_values = values[~(feature_nan | perf_nan)]
373373
filtered_perf_change = abs_perf_change[~(feature_nan | perf_nan)]
374374

375-
tmp1 = pearsonr(filtered_values.ravel(), filtered_perf_change)
375+
tmp1 = (
376+
pearsonr(filtered_values.ravel(), filtered_perf_change)
377+
if len(filtered_values) > 1
378+
else (np.nan, np.nan)
379+
)
376380
spearmanr1.append(tmp1[0])
377381
spearmanr2.append(tmp1[1])
378382

nannyml/drift/univariate/calculator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,10 @@ def _calculate_for_column(
441441
logger.error(
442442
f"an unexpected exception occurred during calculation of method '{method.display_name}': " f"{exc}"
443443
)
444-
result['value'] = np.NaN
444+
result['value'] = np.nan
445445
result['upper_threshold'] = method.upper_threshold_value
446446
result['lower_threshold'] = method.lower_threshold_value
447-
result['alert'] = np.NaN
447+
result['alert'] = np.nan
448448
finally:
449449
return result
450450

nannyml/drift/univariate/methods.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ def _fit(self, reference_data: pd.Series, timestamps: Optional[pd.Series] = None
278278
reference_data = _remove_nans(reference_data)
279279
len_reference = len(reference_data)
280280

281-
bins = np.histogram_bin_edges(reference_data, bins='doane')
281+
# Explicit conversion to float because of
282+
# https://github.com/numpy/numpy/commit/c63969c6e1d58e791632aacfb88ecae465d6dcfc
283+
bins = np.histogram_bin_edges(reference_data.astype("float64"), bins='doane')
282284
reference_proba_in_bins = np.histogram(reference_data, bins=bins)[0] / len_reference
283285
self._bins = bins
284286
self._reference_proba_in_bins = reference_proba_in_bins
@@ -731,7 +733,7 @@ def _fit(self, reference_data: pd.Series, timestamps: Optional[pd.Series] = None
731733
reference_data = _remove_nans(reference_data)
732734
len_reference = len(reference_data)
733735

734-
bins = np.histogram_bin_edges(reference_data, bins='doane')
736+
bins = np.histogram_bin_edges(reference_data.astype("float64"), bins='doane')
735737
reference_proba_in_bins = np.histogram(reference_data, bins=bins)[0] / len_reference
736738
self._bins = bins
737739
self._reference_proba_in_bins = reference_proba_in_bins

nannyml/performance_calculation/metrics/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ def get_chunk_record(self, chunk_data: pd.DataFrame) -> Dict:
197197
self._logger.error(
198198
f"an unexpected exception occurred during calculation of method '{self.display_name}': " f"{exc}"
199199
)
200-
chunk_record[f'{column_name}_sampling_error'] = np.NaN
201-
chunk_record[f'{column_name}'] = np.NaN
200+
chunk_record[f'{column_name}_sampling_error'] = np.nan
201+
chunk_record[f'{column_name}'] = np.nan
202202
chunk_record[f'{column_name}_upper_threshold'] = self.upper_threshold_value
203203
chunk_record[f'{column_name}_lower_threshold'] = self.lower_threshold_value
204-
chunk_record[f'{column_name}_alert'] = np.NaN
204+
chunk_record[f'{column_name}_alert'] = np.nan
205205
finally:
206206
return chunk_record
207207

0 commit comments

Comments
 (0)