diff --git a/src/mlpack/methods/xgboost/loss_functions/sse_loss.hpp b/src/mlpack/methods/xgboost/loss_functions/sse_loss.hpp index fc4b9f3558..8b447371b3 100644 --- a/src/mlpack/methods/xgboost/loss_functions/sse_loss.hpp +++ b/src/mlpack/methods/xgboost/loss_functions/sse_loss.hpp @@ -99,7 +99,7 @@ class SSELoss */ template typename VecType::elem_type - OutputValue(const VecType& gradients, const VecType& hessians) + OutputLeafValue(const VecType& gradients, const VecType& hessians) { return -ApplyL1(arma::accu(gradients)) / (arma::accu(hessians) + lambda); } diff --git a/src/mlpack/tests/xgboost_test.cpp b/src/mlpack/tests/xgboost_test.cpp index fa7ab0fff0..6a147950fc 100644 --- a/src/mlpack/tests/xgboost_test.cpp +++ b/src/mlpack/tests/xgboost_test.cpp @@ -89,21 +89,20 @@ TEST_CASE("SSEResidualsTest", "[XGBTest]") } /** - * Test that output value is calculated correctly for SSE Loss. + * Test that output leaf value is calculated correctly for SSE Loss. */ -TEST_CASE("SSEOutputValueTest", "[XGBTest]") +TEST_CASE("SSELeafValueTest", "[XGBTest]") { arma::vec observed = {1, 3, 2, 2, 5, 6, 9, 11, 8, 8}; arma::vec predicted = {0.5, 1, 2.5, 1.5, 5, 8, 8, 10.75, 9, 9.5}; - // Actual outut value. - double outputValue = -0.075; + // Actual output leaf value. + double leafValue = -0.075; SSELoss Loss; - // Calculating gradients and hessians for input to OutputValue(). + // Calculating gradients and hessians for input to OutputLeafValue(). arma::vec gradients = Loss.Gradients(observed, predicted); arma::vec hessians = Loss.Hessians(observed, predicted); - // Lambda = 0; - REQUIRE(Loss.OutputValue(gradients, hessians) == outputValue); + REQUIRE(Loss.OutputLeafValue(gradients, hessians) == leafValue); }