Refefer / fastxml

FastXML / PFastXML / PFastreXML - Implementation of Extreme Multi-label Classification
Other
149 stars 47 forks source link

Can not run as sample, is something wrong with the source code? #11

Closed BAIMEI1 closed 6 years ago

BAIMEI1 commented 6 years ago

from fastxml import Trainer, Inferencer X = [Sparse or numpy arrays] y = [[1, 3]] # Currently requires list[list[int]] trainer = Trainer(n_trees=32, n_jobs=-1) trainer.fit(X, y) my input X is list of csr_matrix and input y is csr_matrix but after my run error happen like this file ''build/bdist.linux-x86_64/egg/fastxml/trainer.py'', line 389, in _build_roots TypeError: iteration over a 0-d array besides: Only when input X is list of csr_matrix the program is ok def _build_roots(self, X, y, weights): assert isinstance(X, list) and isinstance(X[0], sp.csr_matrix), "Requires list of csr_matrix" if self.n_jobs > 1: f = proc.fork_call(self.grow_root) else: f = proc.faux_fork_call(self.grow_root)

Refefer commented 6 years ago

The error is complaining that you didn't pass in a a list of csr_matrix. My guess is you passed in a single csr_matrix for X, which we disallow due to memory blow up in COW. Note you also claim to pass in a csr_matrix for your y. That needs to be a list of lists for the same reason as X.

Can you provide your X,y preprocessing logic?

Refefer commented 6 years ago

Closing for now.