tffm icon indicating copy to clipboard operation
tffm copied to clipboard

model.fit(X_tr, y_tr, show_progress=True)

Open zenglongjin opened this issue 2 years ago • 0 comments

I used sparse style and the following error occurs: `AttributeError Traceback (most recent call last) in ----> 1 model.fit(X_tr, y_tr, show_progress=True)

~\anaconda3\lib\site-packages\tffm\models.py in fit(self, X, y, sample_weight, n_epochs, show_progress) 124 def fit(self, X, y, sample_weight=None, n_epochs=None, show_progress=False): 125 sample_weight = np.ones_like(y) if sample_weight is None else sample_weight --> 126 self.fit(X=X, y_=y, w_=sample_weight, n_epochs=n_epochs, show_progress=show_progress) 127 128 def predict(self, X, pred_batch_size=None):

~\anaconda3\lib\site-packages\tffm\base.py in fit(self, X, y_, w_, n_epochs, show_progress) 224 # iterate over batches 225 for bX, bY, bW in batcher(X_[perm], y_=y_[perm], w_=w_[perm], batch_size=self.batch_size): --> 226 fd = batch_to_feeddict(bX, bY, bW, core=self.core) 227 ops_to_run = [self.core.trainer, self.core.target, self.core.summary_op] 228 result = self.session.run(ops_to_run, feed_dict=fd)

~\anaconda3\lib\site-packages\tffm\base.py in batch_to_feeddict(X, y, w, core) 79 # sparse case 80 X_sparse = X.tocoo() ---> 81 fd[core.raw_indices] = np.hstack( 82 (X_sparse.row[:, np.newaxis], X_sparse.col[:, np.newaxis]) 83 ).astype(np.int64)

AttributeError: 'TFFMCore' object has no attribute 'raw_indices'`

zenglongjin avatar Mar 29 '22 09:03 zenglongjin