|
1 | 1 | # Generated by using Rcpp::compileAttributes() -> do not edit by hand
|
2 | 2 | # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
|
3 | 3 |
|
4 |
| -#' @rdname fmi |
5 |
| -#' @method fmi factor |
6 |
| -#' @export |
7 |
| -fmi.factor <- function(actual, predicted, ...) { |
8 |
| - .Call(`_SLmetrics_fmi`, actual, predicted) |
9 |
| -} |
10 |
| - |
11 |
| -#' @rdname fmi |
12 |
| -#' @method fmi cmatrix |
13 |
| -#' @export |
14 |
| -fmi.cmatrix <- function(x, ...) { |
15 |
| - .Call(`_SLmetrics_fmi_cmatrix`, x) |
16 |
| -} |
17 |
| - |
18 | 4 | #' @rdname accuracy
|
19 | 5 | #' @method accuracy factor
|
20 | 6 | #'
|
@@ -47,6 +33,22 @@ baccuracy.cmatrix <- function(x, adjust = FALSE, ...) {
|
47 | 33 | .Call(`_SLmetrics_baccuracy_cmatrix`, x, adjust)
|
48 | 34 | }
|
49 | 35 |
|
| 36 | +#' @rdname ckappa |
| 37 | +#' @method ckappa factor |
| 38 | +#' |
| 39 | +#' @export |
| 40 | +ckappa.factor <- function(actual, predicted, beta = 1.0, ...) { |
| 41 | + .Call(`_SLmetrics_ckappa`, actual, predicted, beta) |
| 42 | +} |
| 43 | + |
| 44 | +#' @rdname ckappa |
| 45 | +#' @method ckappa cmatrix |
| 46 | +#' |
| 47 | +#' @export |
| 48 | +ckappa.cmatrix <- function(x, beta = 1.0, ...) { |
| 49 | + .Call(`_SLmetrics_ckappa_cmatrix`, x, beta) |
| 50 | +} |
| 51 | + |
50 | 52 | #' Confusion Matrix
|
51 | 53 | #'
|
52 | 54 | #' @description
|
@@ -185,6 +187,20 @@ fallout.cmatrix <- function(x, micro = NULL, na.rm = TRUE, ...) {
|
185 | 187 | .Call(`_SLmetrics_fallout_cmatrix`, x, micro, na_rm = na.rm)
|
186 | 188 | }
|
187 | 189 |
|
| 190 | +#' @rdname fmi |
| 191 | +#' @method fmi factor |
| 192 | +#' @export |
| 193 | +fmi.factor <- function(actual, predicted, ...) { |
| 194 | + .Call(`_SLmetrics_fmi`, actual, predicted) |
| 195 | +} |
| 196 | + |
| 197 | +#' @rdname fmi |
| 198 | +#' @method fmi cmatrix |
| 199 | +#' @export |
| 200 | +fmi.cmatrix <- function(x, ...) { |
| 201 | + .Call(`_SLmetrics_fmi_cmatrix`, x) |
| 202 | +} |
| 203 | + |
188 | 204 | #' @rdname jaccard
|
189 | 205 | #' @method jaccard factor
|
190 | 206 | #' @export
|
@@ -227,22 +243,6 @@ tscore.cmatrix <- function(x, micro = NULL, na.rm = TRUE, ...) {
|
227 | 243 | .Call(`_SLmetrics_tscore_cmatrix`, x, micro, na_rm = na.rm)
|
228 | 244 | }
|
229 | 245 |
|
230 |
| -#' @rdname ckappa |
231 |
| -#' @method ckappa factor |
232 |
| -#' |
233 |
| -#' @export |
234 |
| -ckappa.factor <- function(actual, predicted, beta = 1.0, ...) { |
235 |
| - .Call(`_SLmetrics_ckappa`, actual, predicted, beta) |
236 |
| -} |
237 |
| - |
238 |
| -#' @rdname ckappa |
239 |
| -#' @method ckappa cmatrix |
240 |
| -#' |
241 |
| -#' @export |
242 |
| -ckappa.cmatrix <- function(x, beta = 1.0, ...) { |
243 |
| - .Call(`_SLmetrics_ckappa_cmatrix`, x, beta) |
244 |
| -} |
245 |
| - |
246 | 246 | #' @rdname mcc
|
247 | 247 | #' @method mcc factor
|
248 | 248 | #' @export
|
@@ -461,6 +461,40 @@ zerooneloss.cmatrix <- function(x, ...) {
|
461 | 461 | .Call(`_SLmetrics_zerooneloss_cmatrix`, x)
|
462 | 462 | }
|
463 | 463 |
|
| 464 | +#' Compute the \eqn{R^2} |
| 465 | +#' |
| 466 | +#' @description |
| 467 | +#' The [rsq()]-function calculates the \eqn{R^2}, the [coefficient of determination](https://en.wikipedia.org/wiki/Coefficient_of_determination), between the ovserved |
| 468 | +#' and predicted <[numeric]> vectors. By default [rsq()] returns the unadjusted \eqn{R^2}. For adjusted \eqn{R^2} set \eqn{k = \kappa - 1}, where \eqn{\kappa} is the number of parameters. |
| 469 | +#' |
| 470 | +#' @usage |
| 471 | +#' # `rsq()`-function |
| 472 | +#' rsq( |
| 473 | +#' actual, |
| 474 | +#' predicted, |
| 475 | +#' k = 0 |
| 476 | +#' ) |
| 477 | +#' |
| 478 | +#' @inherit huberloss |
| 479 | +#' @param k A <[numeric]>-vector of [length] 1. 0 by default. If \eqn{k>0} |
| 480 | +#' the function returns the adjusted \eqn{R^2}. |
| 481 | +#' |
| 482 | +#' @section Calculation: |
| 483 | +#' |
| 484 | +#' The metric is calculated as follows, |
| 485 | +#' |
| 486 | +#' \deqn{ |
| 487 | +#' R^2 = 1 - \frac{\text{SSE}}{\text{SST}} \frac{n-1}{n - (k + 1)} |
| 488 | +#' } |
| 489 | +#' |
| 490 | +#' Where \eqn{\text{SSE}} is the sum of squared errors, \eqn{\text{SST}} is total sum of squared errors, \eqn{n} is the number of observations, and \eqn{k} is the number of non-constant parameters. |
| 491 | +#' |
| 492 | +#' @family regression |
| 493 | +#' |
| 494 | +rsq <- function(actual, predicted, k = 0) { |
| 495 | + .Call(`_SLmetrics_rsq`, actual, predicted, k) |
| 496 | +} |
| 497 | + |
464 | 498 | #' Compute the \eqn{\text{concordance correlation coefficient}}
|
465 | 499 | #'
|
466 | 500 | #' @description
|
@@ -856,40 +890,6 @@ wrmsle <- function(actual, predicted, w) {
|
856 | 890 | .Call(`_SLmetrics_wrmsle`, actual, predicted, w)
|
857 | 891 | }
|
858 | 892 |
|
859 |
| -#' Compute the \eqn{R^2} |
860 |
| -#' |
861 |
| -#' @description |
862 |
| -#' The [rsq()]-function calculates the \eqn{R^2}, the [coefficient of determination](https://en.wikipedia.org/wiki/Coefficient_of_determination), between the ovserved |
863 |
| -#' and predicted <[numeric]> vectors. By default [rsq()] returns the unadjusted \eqn{R^2}. For adjusted \eqn{R^2} set \eqn{k = \kappa - 1}, where \eqn{\kappa} is the number of parameters. |
864 |
| -#' |
865 |
| -#' @usage |
866 |
| -#' # `rsq()`-function |
867 |
| -#' rsq( |
868 |
| -#' actual, |
869 |
| -#' predicted, |
870 |
| -#' k = 0 |
871 |
| -#' ) |
872 |
| -#' |
873 |
| -#' @inherit huberloss |
874 |
| -#' @param k A <[numeric]>-vector of [length] 1. 0 by default. If \eqn{k>0} |
875 |
| -#' the function returns the adjusted \eqn{R^2}. |
876 |
| -#' |
877 |
| -#' @section Calculation: |
878 |
| -#' |
879 |
| -#' The metric is calculated as follows, |
880 |
| -#' |
881 |
| -#' \deqn{ |
882 |
| -#' R^2 = 1 - \frac{\text{SSE}}{\text{SST}} \frac{n-1}{n - (k + 1)} |
883 |
| -#' } |
884 |
| -#' |
885 |
| -#' Where \eqn{\text{SSE}} is the sum of squared errors, \eqn{\text{SST}} is total sum of squared errors, \eqn{n} is the number of observations, and \eqn{k} is the number of non-constant parameters. |
886 |
| -#' |
887 |
| -#' @family regression |
888 |
| -#' |
889 |
| -rsq <- function(actual, predicted, k = 0) { |
890 |
| - .Call(`_SLmetrics_rsq`, actual, predicted, k) |
891 |
| -} |
892 |
| - |
893 | 893 | #' Compute the \eqn{\text{symmetric mean absolute percentage error}}
|
894 | 894 | #'
|
895 | 895 | #' The [smape()]- and [wsmape()]-function computes the simple and weighted [symmetric mean absolute percentage error](https://en.wikipedia.org/wiki/Symmetric_mean_absolute_percentage_error).
|
|
0 commit comments