

@wraps(Cost.expr)
def expr(self, model, data, **kwargs):
    X = data
    p = self.p
    p_hat = tensor.abs_(model.encode(X)).mean(axis=0)
    kl = ((p * tensor.log((p / p_hat))) + ((1 - p) * tensor.log(((1 - p) / (1 - kl)))))
    penalty = (self.coeff * kl.sum())
    penalty.name = 'sparse_activation_penalty'
    return penalty

dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/costs/autoencoder.py SparseActivation.expr/VarMisuse@95/102 `p_hat`->`kl`