Skip to content

Commit

Permalink
prediction: use discrete scores for junk/OOD
Browse files Browse the repository at this point in the history
These scores cannot be treated as probabilities, but the API treats
them like such.
  • Loading branch information
gcampax committed Feb 12, 2021
1 parent d76980f commit c12bc33
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/prediction/localparserclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,22 @@ export default class LocalParserClient {
// convert is_correct and is_probably_correct scores into
// a single scale such that >0.5 is correct and >0.25 is
// probably correct
const score = (c.score.is_correct ?? 1) > 0.5 ? (c.score.is_correct ?? 1) :
((c.score.is_probably_correct ?? 1) * 0.5);
const score = (c.score.is_correct ?? 1) >= 0.5 ? 1 :
(c.score.is_probably_correct ?? 1) >= 0.5 ? 0.35 : 0.15;
return {
code: c.answer.split(' '),
score: score
};
});

intent.ignore = candidates[0].score.is_junk ?? 0;
intent.other = (candidates[0].score.is_ood ?? 0) * (1 - intent.ignore);
if (candidates[0].score.is_junk >= 0.5)
intent.ignore = 1;
else
intent.ignore = 0;
if (intent.ignore < 0.5 && candidates[0].score.is_ood >= 0.5)
intent.other = 1;
else
intent.other = 0;
intent.command = 1 - intent.ignore - intent.other;
}

Expand Down

0 comments on commit c12bc33

Please sign in to comment.