def update(self, grad, subsample_ids=None):
        prev_grad = self._prevgrad
        dW0 = grad['W']
        dv0 = grad['vbias']
        dh0 = grad['hbias']
        if subsample_ids is not None:
            dv0 = np.zeros(self.vbias.shape)
            dW0 = np.zeros(self.W.shape)
            dv0[subsample_ids] = grad['vbias']
            dW0[:, subsample_ids] = grad['W']
        dW = self.momentum * prev_grad['W'] + \
             self.learn_rate * (dW0 - self.l2 * self.W)
        dh = self.momentum * prev_grad['hbias'] + self.learn_rate * dh0
        dv = self.momentum * prev_grad['vbias'] + self.learn_rate * dv0
        self.W += dW
        self.hbias += dh
        self.vbias += dv
        self.fW = self.fw_decay * self.fW + self.flr * dW0 # Fast weight update for PCD
        self._prevgrad['W'] = dW
        self._prevgrad['hbias'] = dh
        self._prevgrad['vbias'] = dv
        return self
Update the RBM parameters W, vbias, hbias, fW using momentum
dataset/ETHPy150Open theusual/kaggle-seeclickfix-ensemble/Miroslaw/sparserbm.py/SparseRBM.update