In the video on the Single Number Evaluation Metric, Professor Ng gives an example where two classifiers A and B are evaluated according to their precision and recall. I thought the cost function was essentially trying to maximize precision, (minimizing negative precision) but now I am not sure.

What exactly is the cost function minimizing?

And, since we have a single metric called the F1 score, could we not set up the cost function to maximize the F1 score?