From b24210908af253a864b23dfb72901a4a808036c0 Mon Sep 17 00:00:00 2001 From: chiricom Date: Thu, 13 Aug 2026 22:04:05 +0000 Subject: [PATCH] Handle kCloglogOrdinal model more thoroughly --- src/forest.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/forest.cpp b/src/forest.cpp index 77c615348..4865508eb 100644 --- a/src/forest.cpp +++ b/src/forest.cpp @@ -492,6 +492,7 @@ void initialize_forest_model_cpp(cpp11::external_pointer init_value_vector; if ((model_type == StochTree::ModelType::kConstantLeafGaussian) || (model_type == StochTree::ModelType::kUnivariateRegressionLeafGaussian) || - (model_type == StochTree::ModelType::kLogLinearVariance)) { + (model_type == StochTree::ModelType::kLogLinearVariance) || + (model_type == StochTree::ModelType::kCloglogOrdinal)) { init_val = init_values.at(0); } else if (model_type == StochTree::ModelType::kMultivariateRegressionLeafGaussian) { int leaf_dim = init_values.size(); @@ -529,6 +531,10 @@ void initialize_forest_model_cpp(cpp11::external_pointerNumObservations(); std::vector initial_preds(n, init_val); data->AddVarianceWeights(initial_preds.data(), n); + } else if (model_type == StochTree::ModelType::kCloglogOrdinal) { + forest_samples->InitializeRoot(init_val / static_cast(num_trees)); + UpdateResidualEntireForest(*tracker, *data, *residual, forest_samples->GetEnsemble(0), false, std::minus()); + tracker->UpdatePredictions(forest_samples->GetEnsemble(0), *data); } } @@ -816,7 +822,8 @@ void initialize_forest_model_active_forest_cpp(cpp11::external_pointer init_value_vector; if ((model_type == StochTree::ModelType::kConstantLeafGaussian) || (model_type == StochTree::ModelType::kUnivariateRegressionLeafGaussian) || - (model_type == StochTree::ModelType::kLogLinearVariance)) { + (model_type == StochTree::ModelType::kLogLinearVariance) || + (model_type == StochTree::ModelType::kCloglogOrdinal)) { init_val = init_values.at(0); } else if (model_type == StochTree::ModelType::kMultivariateRegressionLeafGaussian) { int leaf_dim = init_values.size();