diff --git a/python/dalex/NEWS.md b/python/dalex/NEWS.md index eb89ebb96..1bdf6b2b8 100644 --- a/python/dalex/NEWS.md +++ b/python/dalex/NEWS.md @@ -3,6 +3,9 @@ ### 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)) +* 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` + ### v1.6.0 (2023-02-16) diff --git a/python/dalex/dalex/model_explanations/_aggregated_profiles/utils.py b/python/dalex/dalex/model_explanations/_aggregated_profiles/utils.py index 73a60d3b2..15ded497d 100644 --- a/python/dalex/dalex/model_explanations/_aggregated_profiles/utils.py +++ b/python/dalex/dalex/model_explanations/_aggregated_profiles/utils.py @@ -99,7 +99,7 @@ def split_over_variables_and_labels(split_profile, type, groups, span): def norm(x, loc, scale): - return np.exp(-1 * ((x - loc) / scale) ** 2 / 2) / np.pi / np.sqrt(2) / scale + return np.exp(-1 * ((x - loc) / scale) ** 2 / 2) / np.sqrt(2 * np.pi) / scale def prepare_numerical_categorical(all_profiles, variables, variable_type): @@ -122,7 +122,7 @@ def prepare_numerical_categorical(all_profiles, variables, variable_type): if vnames.shape[0] == 0: raise ValueError("There are no numerical variables") - all_profiles['_x_'] = 0 + all_profiles['_x_'] = 0.0 else: vnames = all_variables[~is_numeric]