70e4d7fe60a9658bb27b9f5fb67592a1222b2ec3,spotlight/sequence/implicit.py,ImplicitSequenceModel,fit,#ImplicitSequenceModel#Any#Any#,60
Before Change
sequences = interactions.sequences.astype(np.int64)
targets = interactions.targets.astype(np.int64)
self._num_items = interactions.num_items
if self._representation == "pooling":
self._net = PoolNet(self._num_items,
self._embedding_dim,
sparse=self._sparse)
elif self._representation == "cnn":
self._net = CNNNet(self._num_items,
self._embedding_dim,
sparse=self._sparse)
else:
self._net = LSTMNet(self._num_items,
self._embedding_dim,
sparse=self._sparse)
if self._optimizer is None:
self._optimizer = optim.Adam(
self._net.parameters(),
weight_decay=self._l2,
lr=self._learning_rate
)
if self._loss == "pointwise":
loss_fnc = pointwise_loss
elif self._loss == "bpr":
loss_fnc = bpr_loss
else:
loss_fnc = hinge_loss
for epoch_num in range(self._n_iter):
sequences, targets = shuffle(sequences,
targets,
random_state=self._random_state)
sequences_tensor = gpu(torch.from_numpy(sequences),
self._use_cuda)
targets_tensor = gpu(torch.from_numpy(targets),
self._use_cuda)
epoch_loss = 0.0
for (batch_sequence,
After Change
sequence_var = Variable(batch_sequence)
user_representation, _ = self._net.user_representation(
sequence_var
)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: maciejkula/spotlight
Commit Name: 70e4d7fe60a9658bb27b9f5fb67592a1222b2ec3
Time: 2017-07-06
Author: maciej.kula@gmail.com
File Name: spotlight/sequence/implicit.py
Class Name: ImplicitSequenceModel
Method Name: fit
Project Name: maciejkula/spotlight
Commit Name: aa1eb21d82804500e2357cde21b18bcf6f87825a
Time: 2017-08-02
Author: maciej.kula@gmail.com
File Name: spotlight/factorization/implicit.py
Class Name: ImplicitFactorizationModel
Method Name: predict
Project Name: maciejkula/spotlight
Commit Name: aa1eb21d82804500e2357cde21b18bcf6f87825a
Time: 2017-08-02
Author: maciej.kula@gmail.com
File Name: spotlight/factorization/explicit.py
Class Name: ExplicitFactorizationModel
Method Name: predict