# log_loss

### cuml.metrics.log_loss(y_true, y_pred, eps=1e-15, normalize=True, sample_weight=None) → [float](https://docs.python.org/3/builtins/functions.html#float)[[source]](https://github.com/NVIDIA/cuml/blob/93418baf5/python/cuml/cuml/metrics/_classification.py#L111)

Log loss, aka logistic loss or cross-entropy loss.
This is the loss function used in (multinomial) logistic regression
and extensions of it such as neural networks, defined as the negative
log-likelihood of a logistic model that returns `y_pred` probabilities
for its training data `y_true`.
The log loss is only defined for two or more labels.

* **Parameters:**
  **y_true**

  **y_pred**
  : shape = (n_samples, n_classes) or (n_samples,)

  **eps**
  : Log loss is undefined for p=0 or p=1, so probabilities are
    clipped to max(eps, min(1 - eps, p)).

  **normalize**
  : If true, return the mean loss per sample.
    Otherwise, return the sum of the per-sample losses.

  **sample_weight**
  : Sample weights.
* **Returns:**
  **loss**

### Notes

The logarithm used is the natural logarithm (base-e).

### References

C.M. Bishop (2006). Pattern Recognition and Machine Learning. Springer,
p. 209.

### Examples

```python
>>> from cuml.metrics import log_loss
>>> import cupy as cp
>>> log_loss(cp.array([1, 0, 0, 1]),
...          cp.array([[.1, .9], [.9, .1], [.8, .2], [.35, .65]]))
0.21616...
```

<!-- !! processed by numpydoc !! -->
