metric_rsquare: RSquare This is also called as coefficient of determination....

View source: R/metrics.R

metric_rsquareR Documentation

RSquare This is also called as coefficient of determination. It tells how close are data to the fitted regression line. Highest score can be 1.0 and it indicates that the predictors perfectly accounts for variation in the target. Score 0.0 indicates that the predictors do not account for variation in the target. It can also be negative if the model is worse.

Description

RSquare

This is also called as coefficient of determination. It tells how close are data to the fitted regression line. Highest score can be 1.0 and it indicates that the predictors perfectly accounts for variation in the target. Score 0.0 indicates that the predictors do not account for variation in the target. It can also be negative if the model is worse.

Usage

metric_rsquare(
  name = "r_square",
  dtype = tf$float32,
  multioutput = "uniform_average",
  y_shape = 1,
  ...
)

Arguments

name

(Optional) String name of the metric instance.

dtype

(Optional) Data type of the metric result. Defaults to 'tf$float32'.

multioutput

one of the following: "raw_values", "uniform_average", "variance_weighted"

y_shape

output tensor shape

...

additional arguments to pass

Value

r squared score: float

Examples


## Not run: 

actuals = tf$constant(c(1, 4, 3), dtype=tf$float32)
preds = tf$constant(c(2, 4, 4), dtype=tf$float32)
result = metric_rsquare()
result$update_state(actuals, preds)
paste('R^2 score is: ', result$result()$numpy()) # 0.57142866


## End(Not run)

henry090/tfaddons documentation built on April 7, 2022, 11:27 p.m.