Пример #1
0
 def __call__(self):
     # delegate to cython implementation
     u, i, j, N, trials = warp_sample(self.decomposition.U,
                                      self.decomposition.V, self.train.data,
                                      self.train.indices, self.train.indptr,
                                      self.positive_thresh, self.max_trials,
                                      self.selected_items)
     return u, i, j, N, trials  #* self.sample_item_rate
Пример #2
0
 def sample(self,train,decomposition):
     # delegate to cython implementation
     return warp_sample(decomposition.U,
                        decomposition.V,
                        train.data,
                        train.indices,
                        train.indptr,
                        self.positive_thresh,
                        self.max_trials)
Пример #3
0
 def __call__(self):
     # delegate to cython implementation
     return warp_sample(self.decomposition.U,
                        self.decomposition.V,
                        self.train.data,
                        self.train.indices,
                        self.train.indptr,
                        self.positive_thresh,
                        self.max_trials,
                        self.selected_items)
Пример #4
0
    def compute_updates(self, train, decomposition, updates):
        updates.clear()
        tot_trials = 0
        ###THIS LINE
        for ix in xrange(self.batch_size):
            ###THIS LINE
            i, yy, N, trials = warp_sample(decomposition.U, decomposition.V,
                                           train, self.max_trials)
            tot_trials += trials
            L = self.estimate_warp_loss(train, yy, N)

            ###THIS LINE
            updates.set_update(ix,
                               decomposition.compute_gradient_step(u, i, j, L))
        return tot_trials
Пример #5
0
 def sample(self, train, decomposition):
     # delegate to cython implementation
     return warp_sample(decomposition.U, decomposition.V, train.data,
                        train.indices, train.indptr, self.positive_thresh,
                        self.max_trials)
Пример #6
0
    def compute_updates(self, train, decomposition, updates):
        updates.clear()

        warp_sample(decomposition.U, decomposition.V, train.data,
                    train.indices, train.indptr, self.positive_thresh,
                    self.max_trials)