Skip to content

Commit

Permalink
drafted metrics.R + working on models.R now
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonfparil committed May 31, 2024
1 parent 1f6575e commit 09b7491
Show file tree
Hide file tree
Showing 8 changed files with 366 additions and 0 deletions.
41 changes: 41 additions & 0 deletions man/fn_estimate_memory_footprint.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions man/fn_filter_genotype.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions man/fn_filter_phenotype.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions man/fn_load_phenotype.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions man/fn_merge_genotype_and_phenotype.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions man/fn_prediction_performance_metrics.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions tests/testthat/test-metrics.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# library(testthat)
# source("/group/pasture/Jeff/gp/R/load.R")
# source("/group/pasture/Jeff/gp/R/metrics.R")

test_that("fn_prediction_performance_metrics", {
n = 100
y_true = 1:n
y_pred = y_true + pi
list_metrics_1 = fn_prediction_performance_metrics(y_true, y_true)
list_metrics_2 = fn_prediction_performance_metrics(y_true, y_pred)
list_metrics_3 = fn_prediction_performance_metrics(y_true, NA)
list_metrics_4 = fn_prediction_performance_metrics(y_true, rep(NA, length(y_true)))
expect_equal(list_metrics_1, list(mbe=0, mae=0, rmse=0, r2=1, corr=1, power_t10=1, power_b10=1, h2=1))
expect_equal(list_metrics_2, list(mbe=-pi, mae=pi, rmse=pi, r2=(1-(n*(pi^2)/sum((y_true-mean(y_true))^2))), corr=1, power_t10=1, power_b10=1, h2=1))
expect_equal(methods::is(list_metrics_3, "gpError"), TRUE)
expect_equal(is.na(list_metrics_4$mbe), TRUE)
expect_equal(is.na(list_metrics_4$mae), TRUE)
expect_equal(is.na(list_metrics_4$rmse), TRUE)
expect_equal(is.na(list_metrics_4$r2), TRUE)
expect_equal(is.na(list_metrics_4$corr), TRUE)
expect_equal(is.na(list_metrics_4$power_t10), TRUE)
expect_equal(is.na(list_metrics_4$power_b10), TRUE)
expect_equal(is.na(list_metrics_4$h2), TRUE)
})
8 changes: 8 additions & 0 deletions tests/testthat/test-models.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# library(testthat)
# source("/group/pasture/Jeff/gp/R/load.R")
# source("/group/pasture/Jeff/gp/R/metrics.R")
# source("/group/pasture/Jeff/gp/R/models.R")

test_that("fn_least_squares_moore_penrose", {

})

0 comments on commit 09b7491

Please sign in to comment.