From 80bc1513793a83f05185a25c2e6dfe35ffeec776 Mon Sep 17 00:00:00 2001 From: William Jeynes Date: Tue, 24 Mar 2026 16:50:41 +0000 Subject: [PATCH] add majority voting --- agent/nodes/robertaMetrics.ts | 19 +++++++++++++++++-- supporting/scorer/views/stats.py | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/agent/nodes/robertaMetrics.ts b/agent/nodes/robertaMetrics.ts index 1c6982d..4e34ea2 100644 --- a/agent/nodes/robertaMetrics.ts +++ b/agent/nodes/robertaMetrics.ts @@ -6,7 +6,6 @@ import { evaluateWithRoberta } from "../tools/robertaCall"; export const robertaMetrics: GraphNode = 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 = 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)] diff --git a/supporting/scorer/views/stats.py b/supporting/scorer/views/stats.py index 62b42fe..3523b28 100644 --- a/supporting/scorer/views/stats.py +++ b/supporting/scorer/views/stats.py @@ -69,6 +69,8 @@ def render(): thresh = 0.1 if ("ensemble" in file_path.name and "2" in file_path.name): thresh = 0.4 + if ("ensemble" in file_path.name and "vot" in file_path.name): + thresh = 0.7 st.subheader(f"File: {file_path.name}")