mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-12 17:57:38 +00:00
Fix positive raw scores for TreeEnsembleClassifier (#2824)
Fix positive raw scores for TreeEnsembleClassifier
This commit is contained in:
parent
b21576eeb0
commit
22d9f3998e
2 changed files with 2 additions and 9 deletions
|
|
@ -322,6 +322,7 @@ void write_scores(std::vector<T>& scores, POST_EVAL_TRANSFORM post_transform, in
|
|||
scores[0] = 1.f - scores[0];
|
||||
break;
|
||||
case 2: //2 = mixed weights, winning class is positive
|
||||
case 3: //3 = mixed weights, winning class is negative
|
||||
if (post_transform == POST_EVAL_TRANSFORM::LOGISTIC) {
|
||||
scores.push_back(ComputeLogistic(scores[0])); //ml_logit(scores[k]);
|
||||
scores[0] = ComputeLogistic(-scores[0]);
|
||||
|
|
@ -330,14 +331,6 @@ void write_scores(std::vector<T>& scores, POST_EVAL_TRANSFORM post_transform, in
|
|||
scores[0] = -scores[0];
|
||||
}
|
||||
break;
|
||||
case 3: //3 = mixed weights, winning class is negative
|
||||
if (post_transform == POST_EVAL_TRANSFORM::LOGISTIC) {
|
||||
scores.push_back(ComputeLogistic(scores[0])); //ml_logit(scores[k]);
|
||||
scores[0] = ComputeLogistic(-scores[0]);
|
||||
} else {
|
||||
scores.push_back(-scores[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ TEST(MLOpTest, TreeEnsembleClassifierLabels) {
|
|||
std::vector<std::string> results = {"label1", "label0", "label0", "label0", "label0", "label1", "label0", "label0"};
|
||||
std::vector<float> probs = {};
|
||||
std::vector<float> log_probs = {};
|
||||
std::vector<float> scores{-5, 5, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -3, 3};
|
||||
std::vector<float> scores{-5, 5, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 3, -3};
|
||||
|
||||
//define the context of the operator call
|
||||
const int N = 8;
|
||||
|
|
|
|||
Loading…
Reference in a new issue