be426ba9d5f569b5eab685d96bb418d11fbb5474,spotlight/factorization/explicit.py,ExplicitFactorizationModel,fit,#ExplicitFactorizationModel#Any#Any#,175

Before Change


                                                         batch_size=self._batch_size)):

                user_var = Variable(batch_user)
                item_var = Variable(batch_item)
                ratings_var = Variable(batch_ratings)

                predictions = self._net(user_var, item_var)

                if self._loss == "poisson":
                    predictions = torch.exp(predictions)

                self._optimizer.zero_grad()

                loss = self._loss_func(ratings_var, predictions)
                epoch_loss += loss.data[0]

                loss.backward()
                self._optimizer.step()

After Change


                self._optimizer.zero_grad()

                loss = self._loss_func(batch_ratings, predictions)
                epoch_loss += loss.item()

                loss.backward()
                self._optimizer.step()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: maciejkula/spotlight
Commit Name: be426ba9d5f569b5eab685d96bb418d11fbb5474
Time: 2018-05-20
Author: maciej.kula@gmail.com
File Name: spotlight/factorization/explicit.py
Class Name: ExplicitFactorizationModel
Method Name: fit


Project Name: maciejkula/spotlight
Commit Name: be426ba9d5f569b5eab685d96bb418d11fbb5474
Time: 2018-05-20
Author: maciej.kula@gmail.com
File Name: spotlight/factorization/implicit.py
Class Name: ImplicitFactorizationModel
Method Name: fit


Project Name: pytorch/examples
Commit Name: 645c7c386e62d2fb1d50f4621c1a52645a13869f
Time: 2018-04-24
Author: soumith@gmail.com
File Name: vae/main.py
Class Name:
Method Name: train


Project Name: batra-mlp-lab/visdial-challenge-starter-pytorch
Commit Name: 9a0c954f2043f39dd43b55346b0fcb3985dd849b
Time: 2018-12-07
Author: karandesai281196@gmail.com
File Name: train.py
Class Name:
Method Name: