return (float) (1.0f / (1.0f + Math.exp(-x)));
}
public static Layer bernoulli(Layer input)
{
Layer output = input.clone();
//using uniform distribution, filter out all negative values
//from inputs, keeping mostly strong weights
for (int i=0; i<output.size(); i++)
output.set(i, staticRand.nextFloat() < input.get(i) ? 1.0f : 0.0f);
return output;
}