From b1548c4a0781af294672a9ca0fce6c20a0ab042c Mon Sep 17 00:00:00 2001 From: Hubert Baniecki Date: Wed, 28 Feb 2024 17:24:29 +0100 Subject: [PATCH] [python] dalex v1.6.1 --- .gitignore | 3 +++ python/dalex/NEWS.md | 10 +++++++--- python/dalex/dalex/__init__.py | 2 +- python/dalex/dalex/_explainer/checks.py | 10 ++++++---- python/dalex/dalex/_explainer/yhat.py | 8 +++++--- python/dalex/dalex/aspect/utils.py | 2 +- python/dalex/test/test_ceteris_paribus.py | 6 +++--- python/dalex/test/test_fairness.py | 10 ++++++---- python/dalex/test/test_model_diagnostics.py | 4 ++-- 9 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index f63e4e5c3..a4f170752 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.vscode/settings.json +**.DS_Store + .Rproj.user .Rhistory .RData diff --git a/python/dalex/NEWS.md b/python/dalex/NEWS.md index 1bdf6b2b8..d8e365ee2 100644 --- a/python/dalex/NEWS.md +++ b/python/dalex/NEWS.md @@ -1,10 +1,14 @@ ## Changelog -### development -* Fix an error occuring in `predict_profile()` when a DataFrame has MultiIndex in `pandas >= 1.3.0` ([#550](https://github.com/ModelOriented/DALEX/pull/550)) +### v1.6.1 (2024-02-28) + +* Added `keras.src.models.sequential.Sequential` to classes with a known `predict_function`; it should fix changes in `keras==3.0.0` and `tensorflow==2.16.0` +* Turn off `verbose` in the predict method of tensorflow/keras models that [changed](https://stackoverflow.com/a/73244830) in `tensorflow>=2.9.0` +* Fix an error occuring in `predict_profile()` when a DataFrame has MultiIndex in `pandas>=1.3.0` ([#550](https://github.com/ModelOriented/DALEX/pull/550)) * Fix gaussian `norm()` calculation in `model_profile()` from `pi*sqrt(2)` to `sqrt(2*pi)` -* Potential fix for a warning (future error) between `prepare_numerical_categorical()` and `prepare_x()` with `pandas == 2.1.0` +* Fix a warning (future error) between `prepare_numerical_categorical()` and `prepare_x()` with `pandas==2.1.0` +* Fix a warning (future error) concerning the default value of `numeric_only` in `pandas.DataFrame.corr()` in `dalex.aspect.calculate_assoc_matrix()` ### v1.6.0 (2023-02-16) diff --git a/python/dalex/dalex/__init__.py b/python/dalex/dalex/__init__.py index 3d1e1b0d2..00b7fce5e 100644 --- a/python/dalex/dalex/__init__.py +++ b/python/dalex/dalex/__init__.py @@ -9,7 +9,7 @@ from .aspect import Aspect -__version__ = '1.6.0.9000' +__version__ = '1.6.1' __all__ = [ "Arena", diff --git a/python/dalex/dalex/_explainer/checks.py b/python/dalex/dalex/_explainer/checks.py index 197d4d717..9ba5c1fa0 100644 --- a/python/dalex/dalex/_explainer/checks.py +++ b/python/dalex/dalex/_explainer/checks.py @@ -1,8 +1,8 @@ # check functions for Explainer.__init__ import numpy as np import pandas as pd +import warnings from copy import deepcopy -from warnings import warn from .helper import verbose_cat, is_y_in_data, get_model_info from .yhat import get_predict_function_and_model_type @@ -199,7 +199,9 @@ def check_predict_function_and_model_type(predict_function, model_type, # check if predict_function accepts arrays try: data_values = data.values[[0]] - predict_function(model, data_values) + with warnings.catch_warnings(): + warnings.simplefilter('ignore') # ignore warnings about feature names in scikit-learn + predict_function(model, data_values) model_info_['arrays_accepted'] = True verbose_cat(" -> predict function : Accepts pandas.DataFrame and numpy.ndarray.", verbose=verbose) @@ -219,11 +221,11 @@ def check_predict_function_and_model_type(predict_function, model_type, # verbose_cat(" -> predicted values : the predict_function returns an error when executed \n", # verbose=verbose) - warn("\n -> predicted values : 'predict_function' returns an Error when executed: \n" + + warnings.warn("\n -> predicted values : 'predict_function' returns an Error when executed: \n" + str(error), stacklevel=2) if not isinstance(y_hat, np.ndarray) or y_hat.shape != (data.shape[0], ): - warn("\n -> predicted values : 'predict_function' must return numpy.ndarray (1d)", stacklevel=2) + warnings.warn("\n -> predicted values : 'predict_function' must return numpy.ndarray (1d)", stacklevel=2) if model_type is None: # model_type not specified diff --git a/python/dalex/dalex/_explainer/yhat.py b/python/dalex/dalex/_explainer/yhat.py index 43264eeeb..be84b144f 100644 --- a/python/dalex/dalex/_explainer/yhat.py +++ b/python/dalex/dalex/_explainer/yhat.py @@ -17,7 +17,8 @@ def yhat_xgboost(m, d): def get_tf_yhat(model): if not (str(type(model)).startswith("