An objective function is the mathematical expression a model or optimization process tries to maximize or minimize.
In machine learning, objective functions define what success means during training. Poorly chosen objectives can improve a metric while producing behavior that is not useful, fair, or safe.