Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when fitting exported ensemble #55

Open
robertmartin8 opened this issue Jan 28, 2018 · 2 comments
Open

Error when fitting exported ensemble #55

robertmartin8 opened this issue Jan 28, 2018 · 2 comments

Comments

@robertmartin8
Copy link

After exporting my ensemble and trying to fit the new base_learner to my data, I encountered the following error:

FutureWarning: 
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
See the documentation here:
http://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
  return self.loc[key]

I don't fully understand the error, but after a bit of digging I found that the guilty line was

base_learner.fit(X[train_idx], y[train_idx]), under the fit method of the XcessivStackedEnsemble class. I fixed this by using y.iloc[train_idx] instead of y[train_idx].

I don't know if this is just a case of human error, but for anyone else having the same issue, this fixed it for me.

@GillesVandewiele
Copy link

It's a pandas warning. loc or iloc should be use, depending on the context and the values in train_idx (if they are values from the index column of the dataframe or just "literal indexes" (as in the position in the dataframe)).

@GillesVandewiele
Copy link

I reproduced this warning. You can fix it by passing numpy matrices instead of Pandas DataFrames to the base learner.

X.values instead of X does the trick ;)

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

No branches or pull requests

2 participants