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

predict: IndexError #27

Description

@kuraga
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 =?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions