[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

predict: IndexError #27

Open
kuraga opened this issue Feb 8, 2017 · 0 comments
Open

predict: IndexError #27

kuraga opened this issue Feb 8, 2017 · 0 comments

Comments

@kuraga
Copy link
kuraga commented Feb 8, 2017
layer_1 = Ensemble([model_xgboost, model_lightgbm])
layer_2 = Ensemble([XGBClassifier()])
stack = EnsembleStack(cv=4)
stack.add_layer(layer_1)
stack.add_layer(layer_2)
model_stack = EnsembleStackClassifier(stack)
y_test_pred_stack = model_stack.predict_proba(X_test)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-37-a466b4b341d5> in <module>()
----> 1 y_test_pred_stack = model_stack.predict(X_test)
      2 score_prediction(y_test, y_test_pred_stack)

/home/sasha/.local/lib64/python3.4/site-packages/brew/stacking/stacker.py in predict(self, X)
     85 
     86     def predict(self, X):
---> 87         out = self.stack.output(X)
     88         return self.combiner.combine(out)
     89 

/home/sasha/.local/lib64/python3.4/site-packages/brew/stacking/stacker.py in output(self, X)
     56 
     57         for layer in self.layers:
---> 58             out = layer.output(input_, mode=self.mode)
     59             input_ = out[:, 1:, :].reshape(
     60                 out.shape[0], (out.shape[1] - 1) * out.shape[2])

/home/sasha/.local/lib64/python3.4/site-packages/brew/base.py in output(self, X, mode)
    187                 if mode == 'probs':
    188                     probas = np.zeros((X.shape[0], n_classes))
--> 189                     probas[:, list(c.classes_)] = c.predict_proba(X)
    190                     out[:, :, i] = probas
    191 

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Python 3.4. list(model_xgboost.classes_) gives [0.0, 1.0]. Why not just probas =?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant