Skip to content

merge validation-dev to main#92

Merged
rid4stat merged 2 commits intovalidation-devfrom
main
Feb 24, 2026
Merged

merge validation-dev to main#92
rid4stat merged 2 commits intovalidation-devfrom
main

Conversation

@rid4stat
Copy link
Collaborator

No description provided.

Ridwan Olaniran and others added 2 commits February 24, 2026 00:53
@rid4stat rid4stat merged commit 8f2362a into validation-dev Feb 24, 2026
3 of 23 checks passed
@@ -149,16 +149,34 @@ predict_custom <- function(x, y = NULL, fit, model, type = "response") {
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change

# Survival: ranger returns a matrix of survival probabilities by timepoint
if (is.matrix(preds) && inherits(fit, "ranger") && fit$treetype == "Surv") {
# If user asks for survival probabilities, return the matrix
if (is.matrix(pr$survival) && inherits(fit, "ranger") && fit$treetype == "Survival") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change
if (is.matrix(pr$survival) && inherits(fit, "ranger") && fit$treetype == "Survival") {
if (
is.matrix(pr$survival) &&
inherits(fit, "ranger") &&
fit$treetype == "Survival"
) {

# If user asks for survival probabilities, return the survival matrix
if (type == "survival") {
return(preds)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change


times <- pr$unique.death.times
surv_matrix <- pr$survival

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change

if (type == "lp") {
lp <- -rowMeans(preds, na.rm = TRUE)
return(as.numeric(lp))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change

)

},
xgboost = function(d, nrounds = 100, params = list(objective = "binary:logistic", eval_metric = "logloss")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change
xgboost = function(d, nrounds = 100, params = list(objective = "binary:logistic", eval_metric = "logloss")) {
xgboost = function(
d,
nrounds = 100,
params = list(objective = "binary:logistic", eval_metric = "logloss")
) {

@@ -141,7 +157,7 @@ default_models <- list(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change

stopifnot(all(c("time", "event") %in% colnames(d)))
formula <- stats::as.formula("survival::Surv(time, event) ~ .")
ranger::ranger(formula, data = d, num.threads = nthreads)
ranger::ranger(formula, data = d, num.trees = 300, num.threads = nthreads)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change
ranger::ranger(formula, data = d, num.trees = 300, num.threads = nthreads)
ranger::ranger(formula, data = d, num.trees = 300, num.threads = nthreads)

ranger::ranger(formula, data = d, num.threads = nthreads)
ranger::ranger(formula, data = d, num.trees = 300, num.threads = nthreads)
},
xgboost = function(d, nrounds = 100, params = list(objective = "survival:cox", eval_metric = "cox-nloglik")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change
xgboost = function(d, nrounds = 100, params = list(objective = "survival:cox", eval_metric = "cox-nloglik")) {
xgboost = function(
d,
nrounds = 100,
params = list(objective = "survival:cox", eval_metric = "cox-nloglik")
) {

@@ -364,7 +364,7 @@ simulate_survival <- function(
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

Suggested change

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[air] reported by reviewdog 🐶

stop("rf (ranger) prediction type not supported or unknown prediction structure.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant