Skip to content

Commit

Permalink
[7.x][ML] Fix wrong model metadata label (elastic#1660)
Browse files Browse the repository at this point in the history
When I was writing model metadata hyperparameters in elastic#1627 , I was outputting eta values and was using downsample_factor label. This RP fixes this.

Backport of elastic#1655.
  • Loading branch information
valeriy42 authored Jan 12, 2021
1 parent c3c03aa commit 1b4459d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/api/CInferenceModelMetadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void CInferenceModelMetadata::hyperparameterImportance(
hyperparameterName = CDataFrameTrainBoostedTreeRunner::DOWNSAMPLE_FACTOR;
break;
case maths::boosted_tree_detail::E_Eta:
hyperparameterName = CDataFrameTrainBoostedTreeRunner::DOWNSAMPLE_FACTOR;
hyperparameterName = CDataFrameTrainBoostedTreeRunner::ETA;
break;
case maths::boosted_tree_detail::E_EtaGrowthRatePerTree:
hyperparameterName = CDataFrameTrainBoostedTreeRunner::ETA_GROWTH_RATE_PER_TREE;
Expand All @@ -234,9 +234,14 @@ void CInferenceModelMetadata::hyperparameterImportance(
hyperparameterName = CDataFrameTrainBoostedTreeRunner::SOFT_TREE_DEPTH_TOLERANCE;
break;
}
m_HyperparameterImportance.emplace_back(
hyperparameterName, item.s_Value, item.s_AbsoluteImportance,
item.s_RelativeImportance, item.s_Supplied);
double absoluteImportance{(std::fabs(item.s_AbsoluteImportance) < 1e-8)
? 0.0
: item.s_AbsoluteImportance};
double relativeImportance{(std::fabs(item.s_RelativeImportance) < 1e-8)
? 0.0
: item.s_RelativeImportance};
m_HyperparameterImportance.emplace_back(hyperparameterName, item.s_Value, absoluteImportance,
relativeImportance, item.s_Supplied);
}
std::sort(m_HyperparameterImportance.begin(),
m_HyperparameterImportance.end(), [](const auto& a, const auto& b) {
Expand Down

0 comments on commit 1b4459d

Please sign in to comment.