Question

I know that I may change loss function to one of the following:

loss : str, 'hinge' or 'log' or 'modified_huber' The loss function to be used. Defaults to 'hinge'. The hinge loss is a margin loss used by standard linear SVM models. The 'log' loss is the loss of logistic regression models and can be used for probability estimation in binary classifiers. 'modified_huber' is another smooth loss that brings tolerance to outliers.

But what the definitions of this functions?
I understand that hinge is max(0, 1 - margin). And what are others too?

Was it helpful?

Solution 2

sklearn's source code is available on GitHub, so you can examine it. List of loss functions can be found in sklearn/linear_model/stochastic_gradient.py. Definitions of that losses are here: sklearn/linear_model/sgd_fast.pyx#L46

OTHER TIPS

Here are the graphs of all these functions, taken from the scikit-learn example gallery:

enter image description here

In the current dev version of the example, the losses are implemented inline in the script.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top