7a82079d10379287ba4e6e42e21b5b3ce8f541bc,spotlight/sequence/implicit.py,ImplicitSequenceModel,fit,#ImplicitSequenceModel#Any#Any#,100

Before Change


                positive_prediction = self._net(user_representation,
                                                sequence_var)

                if self._loss == "adaptive_hinge":
                    raise NotImplementedError
                else:
                    negative_items = sample_items(
                        self._num_items,
                        batch_sequence.size(),
                        random_state=self._random_state)
                    negative_var = Variable(
                        gpu(torch.from_numpy(negative_items), self._use_cuda)
                    )
                    negative_prediction = self._net(user_representation,
                                                    negative_var)

                self._optimizer.zero_grad()

                loss = loss_fnc(positive_prediction,
                                negative_prediction,

After Change


                                                sequence_var)

                if self._loss == "adaptive_hinge":
                    negative_prediction = [self._get_negative_prediction(sequence_var.size(),
                                                                         user_representation)
                                           for _ in range(5)]
                else:
                    negative_prediction = self._get_negative_prediction(sequence_var.size(),
                                                                        user_representation)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: maciejkula/spotlight
Commit Name: 7a82079d10379287ba4e6e42e21b5b3ce8f541bc
Time: 2017-07-13
Author: maciej.kula@gmail.com
File Name: spotlight/sequence/implicit.py
Class Name: ImplicitSequenceModel
Method Name: fit


Project Name: maciejkula/spotlight
Commit Name: 7a82079d10379287ba4e6e42e21b5b3ce8f541bc
Time: 2017-07-13
Author: maciej.kula@gmail.com
File Name: spotlight/sequence/implicit.py
Class Name: ImplicitSequenceModel
Method Name: fit


Project Name: cornellius-gp/gpytorch
Commit Name: 60a342edc8b501802135df44869353cc8604d838
Time: 2018-01-11
Author: gpleiss@gmail.com
File Name: gpytorch/lazy/kronecker_product_lazy_variable.py
Class Name: KroneckerProductLazyVariable
Method Name: _matmul_closure_factory


Project Name: allenai/allennlp
Commit Name: 5f6c9b8ca29b56ab2d2e1acfc38ea61001b92c4b
Time: 2018-02-07
Author: mattg@allenai.org
File Name: allennlp/common/testing/model_test_case.py
Class Name: ModelTestCase
Method Name: ensure_batch_predictions_are_consistent