Skip to content

Commit

Permalink
Revised how names are created and set for familiarEnsemble and famili…
Browse files Browse the repository at this point in the history
…arModel objects.
  • Loading branch information
alexzwanenburg committed Jan 3, 2025
1 parent 0888af1 commit f2b407d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
12 changes: 5 additions & 7 deletions R/FamiliarEnsemble.R
Original file line number Diff line number Diff line change
Expand Up @@ -911,14 +911,11 @@ setMethod(
"get_object_name",
signature(object = "familiarEnsemble"),
function(object, abbreviated = FALSE) {
# Extract data and run id
ensemble_data_id <- object@run_table$ensemble_data_id
ensemble_run_id <- object@run_table$ensemble_run_id

if (abbreviated) {
# Create an abbreviated name
model_name <- paste0(
"ensemble", ".", ensemble_data_id, ".", ensemble_run_id
"ensemble", ".", object@data_id, ".", object@run_id
)

} else {
Expand All @@ -927,10 +924,9 @@ setMethod(
learner = object@learner,
vimp_method = object@vimp_method,
project_id = object@project_id,
data_id = ensemble_data_id,
run_id = ensemble_run_id,
data_id = object@data_id,
run_id = object@run_id,
object_type = "familiarEnsemble",
is_ensemble = TRUE,
with_extension = FALSE
)
}
Expand All @@ -939,6 +935,8 @@ setMethod(
}
)



# model_is_trained (ensemble) --------------------------------------------------
setMethod(
"model_is_trained",
Expand Down
11 changes: 4 additions & 7 deletions R/FamiliarModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -758,22 +758,19 @@ setMethod(
"get_object_name",
signature(object = "familiarModel"),
function(object, abbreviated = FALSE) {
# Extract data and run id
model_data_id <- tail(object@run_table, n = 1L)$data_id
model_run_id <- tail(object@run_table, n = 1L)$run_id


if (abbreviated) {
# Create an abbreviated name
model_name <- paste0("model.", model_data_id, ".", model_run_id)
model_name <- paste0("model.", object@data_id, ".", object@run_id)

} else {
# Create the full name of the model
model_name <- get_object_file_name(
learner = object@learner,
vimp_method = object@vimp_method,
project_id = object@project_id,
data_id = model_data_id,
run_id = model_run_id,
data_id = object@data_id,
run_id = object@run_id,
object_type = "familiarModel",
with_extension = FALSE
)
Expand Down

0 comments on commit f2b407d

Please sign in to comment.