
Model evaluation metrics
morie_model_metrics.RdClassification and calibration metrics: the confusion-matrix summaries, Matthews correlation, the Brier score, and principal-component and penalised-regression baselines.
Usage
morie_binary_metrics(y_true, y_pred, positive = 1)
morie_class_metrics(conf, i)
morie_mcc(y_true, y_pred, positive = 1)
morie_brier(probs, y_true, halved = FALSE)
morie_pca(X, k = NULL)
morie_ridge(X, y, lambda, add_intercept = TRUE)Arguments
- X
predictor matrix
- y
response vector
- y_true
argument
y_true; not described in the source.- y_pred
argument
y_pred; not described in the source.- positive
argument
positive; not described in the source.- conf
argument
conf; not described in the source.- i
argument
i; not described in the source.- probs
argument
probs; not described in the source.- halved
argument
halved; not described in the source.- k
argument
k; not described in the source.- lambda
argument
lambda; not described in the source.- add_intercept
argument
add_intercept; not described in the source.
Value
A list holding the fitted quantities for the method called: point estimates, fitted values and any diagnostics it produces. See the individual method descriptions above for the components each returns.
Details
These functions mirror, in R, the implementations in the Python package
morie; the two are checked against each other by the parity
tests in tests/testthat/.
Examples
set.seed(3)
X <- matrix(rnorm(40), 10, 4)
morie_pca(X, k = 2)
#> $eigenvalues
#> [1] 1.921200 1.224633 0.684857 0.169310
#>
#> $sd_pc
#> [1] 1.3860737 1.1066313 0.8275609 0.4114730
#>
#> $loadings
#> [,1] [,2] [,3] [,4]
#> [1,] -0.4029045 0.4605630 0.7908539 -0.009988788
#> [2,] 0.6640477 0.1480371 0.2607423 0.684937301
#> [3,] -0.2807207 0.7118363 -0.5534056 0.328979024
#> [4,] -0.5638302 -0.5091717 0.0174860 0.650026092
#>
#> $scores
#> [,1] [,2] [,3] [,4]
#> [1,] -0.3062552 -1.06041104 -0.84688479 -0.11810897
#> [2,] -0.8191189 -1.03789644 -0.15057118 -0.67303265
#> [3,] -0.8247978 0.02158231 0.04162656 -0.12994133
#> [4,] 1.1771499 -1.70403742 0.01083765 0.27527424
#> [5,] 0.9751565 0.73945391 0.44480029 -0.42585448
#> [6,] -0.1548377 -0.42864664 0.31332530 0.04168444
#> [7,] -1.8595433 0.54689675 -1.03431258 0.69026459
#> [8,] -0.9803263 1.97124228 0.07804003 -0.27652625
#> [9,] 3.0036138 0.99906493 -0.73163465 0.16972038
#> [10,] -0.2110411 -0.04724864 1.87477337 0.44652003
#>
#> $compressed
#> [,1] [,2]
#> [1,] -0.3062552 -1.06041104
#> [2,] -0.8191189 -1.03789644
#> [3,] -0.8247978 0.02158231
#> [4,] 1.1771499 -1.70403742
#> [5,] 0.9751565 0.73945391
#> [6,] -0.1548377 -0.42864664
#> [7,] -1.8595433 0.54689675
#> [8,] -0.9803263 1.97124228
#> [9,] 3.0036138 0.99906493
#> [10,] -0.2110411 -0.04724864
#>
#> $prop_variance
#> [1] 0.4803000 0.3061582 0.1712142 0.0423275
#>
#> $cum_variance
#> [1] 0.4803000 0.7864582 0.9576725 1.0000000
#>