Theano logistic regression example
I do not understand the next line, the cost. Shouldn't the cost be equal to the xent, i.e. the loss? What is the cost function representing here? 


The cost is the error (xent.mean()) + some regularization (0.01 * (w ** 2).sum())


  Why is the bias initially set to 0 and not a random number like the weights?


It is possible and common to initialize the biases to be zero, since the asymmetry breaking is provided by the small random numbers in the weights. 

More details here.