add majority voting

This commit is contained in:
William Jeynes
2026-03-24 16:50:41 +00:00
parent 5ce64290ce
commit 80bc151379
2 changed files with 19 additions and 2 deletions
+17 -2
View File
@@ -6,7 +6,6 @@ import { evaluateWithRoberta } from "../tools/robertaCall";
export const robertaMetrics: GraphNode<typeof MessagesState> = async (state) => {
const answer = state.proposedTriggerEvent[state.proposedTriggerEventIndex].Event
//Option 1:
const lrresult = await evaluateWithRoberta({answer, method:"logreg"})
const lrscore = lrresult.validProb - lrresult.invalidProb;
@@ -16,7 +15,23 @@ export const robertaMetrics: GraphNode<typeof MessagesState> = async (state) =>
const flresult = await evaluateWithRoberta({answer, method:"flan"})
const flscore = flresult.validProb - flresult.invalidProb;
const score = lrscore * 0.3 + roscore * 0.5 + flscore * 0.3
//Option 1: combining scores
// const score = lrscore * 0.3 + roscore * 0.5 + flscore * 0.3
//Option 2: majority voting
const rovote = roscore > 0.6
const flvote = flscore > 0.94
const lrvote = lrscore > 0.75
let counter = 0
if (rovote) counter++
if (flvote) counter++
if (lrvote) counter++
let score = 0
if (counter >= 2) {
score = 0.7 + lrscore + flscore + lrscore
}
return {
messages: [ new AIMessage("ROBERTA:" + score)]