13e233ce7b50e463d557ec7964c11e4db5a5cb1f,elephas/optimizers.py,Adagrad,get_updates,#Adagrad#Any#Any#Any#,121

Before Change


        self.lr = shared_scalar(lr)

    def get_updates(self, params, constraints, grads):
        accumulators = [shared_zeros(p.get_value().shape) for p in params]
        self.updates = []

        for p, g, a, c in zip(params, grads, accumulators, constraints):
            new_a = a + g ** 2  // update accumulator
            self.updates.append((a, new_a))
            new_p = p - self.lr * g / T.sqrt(new_a + self.epsilon)
            self.updates.append((p, c(new_p)))  // apply constraints
        return c(new_p)

    def get_config(self):
        return {"name": self.__class__.__name__,
                "lr": float(self.lr.get_value()),

After Change



    def get_updates(self, params, constraints, grads):
        //accumulators = [shared_zeros(theano.shared(p).get_value().shape) for p in params]
        accumulators = [np.zeros_like(p) for p in params]
        //self.updates = []
        new_weights = []
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: maxpumperla/elephas
Commit Name: 13e233ce7b50e463d557ec7964c11e4db5a5cb1f
Time: 2015-11-16
Author: max.pumperla@googlemail.com
File Name: elephas/optimizers.py
Class Name: Adagrad
Method Name: get_updates


Project Name: maxpumperla/elephas
Commit Name: 16b7d06575fb72f3a0c9d09f38efc17066daf473
Time: 2015-11-16
Author: max.pumperla@googlemail.com
File Name: elephas/optimizers.py
Class Name: RMSprop
Method Name: get_updates


Project Name: maxpumperla/elephas
Commit Name: 16b7d06575fb72f3a0c9d09f38efc17066daf473
Time: 2015-11-16
Author: max.pumperla@googlemail.com
File Name: elephas/optimizers.py
Class Name: SGD
Method Name: get_updates