-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
We can consolidate something here:
set_tailor_type()
updates the type
based on the outcome, while update_type()
determines the classification type
from the number of probability columns, i.e., from the predictors. Both are being called only in fit.tailor()
.
Lines 286 to 308 in b5e1325
set_tailor_type <- function(object, y, call = caller_env()) { | |
if (object$type != "unknown") { | |
check_variable_type(y, object$type, "outcome", call = call) | |
return(object) | |
} | |
if (is.factor(y)) { | |
lvls <- levels(y) | |
if (length(lvls) == 2) { | |
object$type <- "binary" | |
} else { | |
object$type <- "multiclass" | |
} | |
} else if (is.numeric(y)) { | |
object$type <- "regression" | |
} else { | |
cli_abort( | |
"Only factor and numeric outcomes are currently supported.", | |
call = call | |
) | |
} | |
object | |
} | |
Lines 129 to 136 in b5e1325
update_type <- function(type, probabilities) { | |
if (type == "binary") { | |
if (length(probabilities) > 2) { | |
type <- "multiclass" | |
} | |
} | |
type | |
} |
Metadata
Metadata
Assignees
Labels
No labels