chainer.functions.r2_score

chainer.functions.r2_score(pred, true, sample_weight=None, multioutput='uniform_average')[source]

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

Parameters
  • pred (Variable or N-dimensional array) – Variable holding a vector, matrix or tensor of estimated target values.

  • true (Variable or N-dimensional array) – Variable holding a vector, matrix or tensor of correct target values.

  • sample_weight – This argument is for compatibility with scikit-learn’s implementation of r2_score. Current implementation admits None only.

  • multioutput (string) – [‘uniform_average’, ‘raw_values’]. if ‘uniform_average’, this function returns an average of R^2 score of multiple output. If ‘raw_average’, this function return a set of R^2 score of multiple output.

Returns

A Variable holding a scalar array of the R^2 score if ‘multioutput’ is ‘uniform_average’ or a vector of R^2 scores if ‘multioutput’ is ‘raw_values’.

Return type

Variable

Note

This function is non-differentiable.