Two ways of optimize the same function i m reading actually this tutorial about deepLearning and in particurlar about Logistic Regression.
http://deeplearning.net/tutorial/logreg.html#logreg
I don't get why it first says to optimize logistic regression taking the max Probability and after using the Log loss function ?
Sorry you can explain me the point where him will use the Argmax and where Will use the Loss ? 
you would not need only 1 of this 2 ? 
 A: I'm not quite sure I understand your question, but the short answer is that the argmax is not involved in optimizing the function. 
The idea is that $p(y \vert x)$ contains the probability of an item (or rather, a minibatch of items) being assigned to each of the possible classes. If you want to make a prediction, you would choose the class with the highest probability, as in:
self.y_pred = T.argmax(self.p_y_given_x, axis=1)

On the other hand, to update the model parameters, the example is performing stochastic gradient descent on the log loss, which effectively tries to maximize the probability of the true label for each item. This is defined in the function:
def negative_log_likelihood(self, y):
    return -T.mean(T.log(self.p_y_given_x)[T.arange(y.shape[0]), y])

where y is used to select the probability of the true label for each item from p_y_given_x.
It may look to you like the argmax is being computed before the log likelihood, but this is not the case. The key thing to understand is that the lines above are defining operations on symbolic variables in theano, and they will not be actually used until needed. In this case, the optimization for a minibatch happens when the train_model function is called:
minibatch_avg_cost = train_model(minibatch_index)

train_model is a theano function, defined as:
train_model = theano.function(
    inputs=[index],
    outputs=cost,
    updates=updates,
    givens={
        x: train_set_x[index * batch_size: (index + 1) * batch_size],
        y: train_set_y[index * batch_size: (index + 1) * batch_size]
    }
)

This definition tells you that when it is called, it will update the parameters according to:
updates = [(classifier.W, classifier.W - learning_rate * g_W),
           (classifier.b, classifier.b - learning_rate * g_b)]

classifier.W and classifier.b are the relevant model parameters. g_W and g_b in turn are gradients which are computed automatically by the lines:
g_W = T.grad(cost=cost, wrt=classifier.W)
g_b = T.grad(cost=cost, wrt=classifier.b)

Finally, these gradients are computed using the cost function:
cost = classifier.negative_log_likelihood(y)

which is the symbolic operation defined above. In other words, the argmax is not used in updating the model parameters. That argmax function is only called when the model needs to make a prediction, as in the predict_model function or the errors function, which compares $y$ to $\hat y$.
