

@wraps(Cost.expr)
def expr(self, model, data, **kwargs):
    self.get_data_specs(model)[0].validate(data)
    X = data
    X_dense = theano.sparse.dense_from_sparse(X)
    noise = self.random_stream.binomial(size=X_dense.shape, n=1, prob=self.one_ratio, ndim=None)
    P = (noise + X_dense)
    P = theano.tensor.switch((P > 0), 1, 0)
    P = tensor.cast(P, theano.config.floatX)
    reg_units = theano.tensor.abs_(model.encode(X)).sum(axis=1).mean()
    before_activation = model.reconstruct_without_dec_acti(X, P)
    cost = (((1 * X_dense) * tensor.log(tensor.log((1 + tensor.exp(((- 1) * before_activation)))))) + ((1 - X_dense) * tensor.log((1 + tensor.log((1 + tensor.exp(before_activation)))))))
    cost = (cost * P).sum(axis=1).mean()
    cost = (cost + (self.L1 * reg_units))
    return cost

dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/costs/autoencoder.py SampledMeanBinaryCrossEntropy.expr/original