geffy / tffm

TensorFlow implementation of an arbitrary order Factorization Machine
MIT License
780 stars 176 forks source link

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

Open zenglongjin opened 2 years ago

zenglongjin commented 2 years ago

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'`