# r2_score

### cuml.metrics.r2_score(y_true, y_pred, , sample_weight=None, multioutput='uniform_average', force_finite=True)[[source]](https://github.com/NVIDIA/cuml/blob/93418baf5/python/cuml/cuml/metrics/regression.py#L82)

$R^2$ (coefficient of determination) regression score function.

Best possible score is 1.0 and it can be negative (because the
model can be arbitrarily worse). In the general case when the true y is
non-constant, a constant model that always predicts the average y
disregarding the input features would get a $R^2$ score of 0.0.

* **Parameters:**
  **y_true**
  : Ground truth (correct) target values.

  **y_pred**
  : Estimated target values.

  **sample_weight**
  : Sample weights.

  **multioutput**
  : How to aggregate multioutput scores. One of:
    - ‘uniform_average’: Scores of all outputs are averaged with uniform weight.
      This is the default.
    - ‘variance_weighted’: Scores of all outputs are averaged, weighted by the
      variances of each individual output.
    - ‘raw_values’: Full set of scores in case of multioutput input.
    - array-like: Weights to use when averaging scores of all outputs.

  **force_finite**
  : Flag indicating if `NaN` and `-Inf` scores resulting from constant
    data should be replaced with real numbers (`1.0` if prediction is
    perfect, `0.0` otherwise). Default is `True`.
* **Returns:**
  **z**
  : The $R^2$ score or ndarray of scores if ‘multioutput’ is
    ‘raw_values’.

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