add majority voting
This commit is contained in:
@@ -6,7 +6,6 @@ import { evaluateWithRoberta } from "../tools/robertaCall";
|
|||||||
export const robertaMetrics: GraphNode<typeof MessagesState> = async (state) => {
|
export const robertaMetrics: GraphNode<typeof MessagesState> = async (state) => {
|
||||||
const answer = state.proposedTriggerEvent[state.proposedTriggerEventIndex].Event
|
const answer = state.proposedTriggerEvent[state.proposedTriggerEventIndex].Event
|
||||||
|
|
||||||
//Option 1:
|
|
||||||
const lrresult = await evaluateWithRoberta({answer, method:"logreg"})
|
const lrresult = await evaluateWithRoberta({answer, method:"logreg"})
|
||||||
const lrscore = lrresult.validProb - lrresult.invalidProb;
|
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 flresult = await evaluateWithRoberta({answer, method:"flan"})
|
||||||
const flscore = flresult.validProb - flresult.invalidProb;
|
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 {
|
return {
|
||||||
messages: [ new AIMessage("ROBERTA:" + score)]
|
messages: [ new AIMessage("ROBERTA:" + score)]
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ def render():
|
|||||||
thresh = 0.1
|
thresh = 0.1
|
||||||
if ("ensemble" in file_path.name and "2" in file_path.name):
|
if ("ensemble" in file_path.name and "2" in file_path.name):
|
||||||
thresh = 0.4
|
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}")
|
st.subheader(f"File: {file_path.name}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user