-
Notifications
You must be signed in to change notification settings - Fork 252
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
Issue when run your example #12
Comments
Hi, What't the dimension of X and y? Are you sure they're both numpy arrays? |
Hi Daniel, I have the same problem as @robinbing. Here is my test code import numpy as np
from sklearn.ensemble import RandomForestClassifier
from boruta_py import BorutaPy
# load X and y
# NOTE BorutaPy accepts numpy arrays only, hence the .values attribute
#X = pd.read_csv('my_X_table.csv', index_col=0).values
#y = pd.read_csv('my_y_vector.csv', index_col=0).values
X = 10*np.random.random((1000,210))
y = np.zeros(1000, dtype=int)
y[np.random.random(1000) >= 0.5] = 1
# define random forest classifier, with utilising all cores and
# sampling in proportion to y labels
rf = RandomForestClassifier(n_jobs=-1, class_weight='auto', max_depth=5)
# define Boruta feature selection method
feat_selector = BorutaPy(rf, n_estimators='auto', verbose=2, max_iter=1000)
# find all relevant features
feat_selector.fit(X, y)
# check selected features
feat_selector.support_
# check ranking of features
feat_selector.ranking_
# call transform() on X to filter it down to selected features
X_filtered = feat_selector.transform(X) it's basically your same example code, but with randomly generated data. Here is the error:
It seems an error of Note: It was tested on Anaconda's |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
When I run your example code, at line 'feat_selector.fit(X,y)', I have red words 'TypeError: unhashable type: 'slice''. So I tried to change y = y.values and x = x.values. Then after 99 iterations (maxrun = 100), there is another red words 'TypeError: iteration over a 0-d array'.
So I was wondering what happen there... Thanks a lot
The text was updated successfully, but these errors were encountered: