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

trying to use bagging, not working with document-term-matrix #38

Open
sanjeev8988 opened this issue Jul 11, 2018 · 0 comments
Open

trying to use bagging, not working with document-term-matrix #38

sanjeev8988 opened this issue Jul 11, 2018 · 0 comments

Comments

@sanjeev8988
Copy link

Using bagging for text classification, trying to work with document-term-matrix,
in ()
7 tree = DecisionTreeClassifier(max_depth=1, min_samples_leaf=1)
8 bag = Bagging(base_classifier=tree, n_classifiers=10)
----> 9 bag.fit(X_train_dtm, y_train)
10
11 div = Diversity(metric='q')

C:\Anaconda3\lib\site-packages\brew-0.1.4-py3.5.egg\brew\generation\bagging.py in fit(self, X, y)
27 # bootstrap
28 idx = np.random.choice(X.shape[0], X.shape[0], replace=True)
---> 29 data, target = X[idx, :], y[idx]
30
31 classifier = sklearn.base.clone(self.base_classifier)

TypeError: only integer scalar arrays can be converted to a scalar index

In this, X_train_dtm is a document-term-matrix, which is a sparse matrix, Is there any way to solve this problem.

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