From 35944a13b49836853be7f40d7e508dad7e31ac09 Mon Sep 17 00:00:00 2001 From: Den Raskovalov Date: Sun, 6 Sep 2015 20:41:55 -0700 Subject: [PATCH] make XGBClassifier.score compatible with arrays --- python-package/xgboost/sklearn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/xgboost/sklearn.py b/python-package/xgboost/sklearn.py index 6f176972a..a2761c5ab 100644 --- a/python-package/xgboost/sklearn.py +++ b/python-package/xgboost/sklearn.py @@ -319,7 +319,7 @@ class XGBClassifier(XGBModel, XGBClassifierBase): if len(class_probs.shape) > 1: column_indexes = np.argmax(class_probs, axis=1) else: - column_indexes = np.repeat(0, data.shape[0]) + column_indexes = np.repeat(0, class_probs.shape[0]) column_indexes[class_probs > 0.5] = 1 return self._le.inverse_transform(column_indexes)