Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning on nas in prediction, error in test #54

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
warning on nas in prediction, error in test
  • Loading branch information
rcannood committed May 30, 2024
commit a8941a7ca4a952356668c6c144413026c48972d2
8 changes: 8 additions & 0 deletions src/task/metrics/mean_correlation_r/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ prediction <- prediction[, genes]
de_test_X <- de_test$layers[[par$de_test_layer]]
prediction_X <- prediction$layers[[par$prediction_layer]]

if (any(is.na(de_test_X))) {
stop("NA values in de_test_X")
}
if (any(is.na(prediction_X))) {
warning("NA values in prediction_X")
prediction_X[is.na(prediction_X)] <- 0
}

cat("Calculate metrics\n")
out <- cor(t(de_test_X), t(prediction_X), method = "pearson")
pearson <- diag(out)
Expand Down
8 changes: 8 additions & 0 deletions src/task/metrics/mean_cosine_sim_r/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ prediction <- prediction[, genes]
de_test_X <- de_test$layers[[par$de_test_layer]]
prediction_X <- prediction$layers[[par$prediction_layer]]

if (any(is.na(de_test_X))) {
stop("NA values in de_test_X")
}
if (any(is.na(prediction_X))) {
warning("NA values in prediction_X")
prediction_X[is.na(prediction_X)] <- 0
}

cat("Clipping values\n")
threshold_0001 <- -log10(0.0001)
de_test_X_clipped_0001 <- pmax(pmin(de_test_X, threshold_0001), -threshold_0001)
Expand Down
3 changes: 2 additions & 1 deletion src/task/metrics/mean_rowwise_error_r/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ if (any(is.na(de_test_X))) {
stop("NA values in de_test_X")
}
if (any(is.na(prediction_X))) {
stop("NA values in prediction_X")
warning("NA values in prediction_X")
prediction_X[is.na(prediction_X)] <- 0
}

cat("Clipping values\n")
Expand Down