Skip to content

Commit 2519472

Browse files
committed
fix bug with wrong dim of y; bump version to 2.0.2.1 for bugfix
1 parent 243eb26 commit 2519472

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="vimpy",
8-
version="2.0.2",
8+
version="2.0.2.1",
99
author="Brian Williamson",
1010
author_email="[email protected]",
1111
description="vimpy: perform inference on algorithm-agnostic variable importance in python",

vimpy/predictiveness_measures.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,10 @@ def one_r2_ic(y, preds):
442442
"""
443443
import sklearn.metrics as skm
444444
import numpy as np
445-
mse = skm.mean_squared_error(y_true = y, y_pred = preds)
446-
var = np.mean((y - np.mean(y)) ** 2)
447-
ic_mse = (y.reshape(preds.shape) - preds) ** 2 - mse
448-
ic_var = (y - np.mean(y)) ** 2 - var
445+
y_flat = np.ravel(y)
446+
mse = skm.mean_squared_error(y_true = y_flat, y_pred = preds)
447+
var = np.mean((y_flat - np.mean(y_flat)) ** 2)
448+
ic_mse = (y_flat - preds) ** 2 - mse
449+
ic_var = (y_flat - np.mean(y_flat)) ** 2 - var
449450
grad = np.array([1. / var, (-1) * mse / (var ** 2)])
450451
return np.dot(grad, np.stack((ic_mse, ic_var)))

0 commit comments

Comments
 (0)