Yang Chung commited on
Commit
e57087d
·
1 Parent(s): dc5442f

Pick largest value from methods

Browse files
Files changed (1) hide show
  1. src/App.js +17 -55
src/App.js CHANGED
@@ -25,13 +25,6 @@ const BenchmarkChart = () => {
25
  root_problem: 67.19
26
  }
27
  },
28
- {
29
- model: "Gemini 3",
30
- baseline: 55.67,
31
- methods: {
32
- keyword_objective_combined: 55.67,
33
- }
34
- },
35
  {
36
  model: "Mixtral 8x22B",
37
  baseline: 48.00,
@@ -46,6 +39,13 @@ const BenchmarkChart = () => {
46
  keyword_objective_combined: 56.46
47
  }
48
  },
 
 
 
 
 
 
 
49
  {
50
  model: "Claude 4 Sonnet",
51
  baseline: 26.33,
@@ -78,63 +78,25 @@ const BenchmarkChart = () => {
78
  ];
79
 
80
  const [currentPhase, setCurrentPhase] = useState('baseline');
81
- const [currentMethodIndex, setCurrentMethodIndex] = useState(0);
82
-
83
- const synthesisMethodsOrder = ['keyword_objective_combined', 'root_problem'];
84
 
85
  const getCurrentValue = (modelData, phase) => {
86
  if (phase === 'baseline') {
87
  return modelData.baseline;
88
- } else if (phase === 'additive_synthesis') {
 
89
  let maxASR = modelData.baseline;
90
 
91
- for (let i = 0; i < currentMethodIndex; i++) {
92
- const method = synthesisMethodsOrder[i];
93
- if (modelData.methods[method] !== undefined) {
94
- maxASR = Math.max(maxASR, modelData.methods[method]);
95
- }
96
- }
97
 
98
  return maxASR;
99
  }
100
  return 0;
101
  };
102
 
103
- const getCurrentMethod = (modelData, phase) => {
104
- if (phase === 'baseline') return 'Human Baseline';
105
- if (currentMethodIndex === 0) return 'Human Baseline';
106
-
107
- const availableMethods = [];
108
- for (let i = 0; i < currentMethodIndex; i++) {
109
- const method = synthesisMethodsOrder[i];
110
- if (modelData.methods[method] !== undefined) {
111
- availableMethods.push(method);
112
- }
113
- }
114
-
115
- if (availableMethods.length === 0) return 'Human Baseline';
116
-
117
- const lastMethod = availableMethods[availableMethods.length - 1];
118
- let transformationName;
119
- if (lastMethod === 'keyword_objective_combined') transformationName = 'Keyword/Objective Transformation';
120
- else if (lastMethod === 'root_problem') transformationName = 'Root Problem Transformation';
121
- else transformationName = lastMethod.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
122
-
123
- return `Human Baseline + ${transformationName}`;
124
- };
125
-
126
- const handleManualAnimate = () => {
127
- if (currentPhase === 'baseline') {
128
- setCurrentPhase('additive_synthesis');
129
- setCurrentMethodIndex(0);
130
-
131
- // Manually step through methods
132
- setTimeout(() => setCurrentMethodIndex(1), 500);
133
- setTimeout(() => setCurrentMethodIndex(2), 2500);
134
- } else {
135
- setCurrentPhase('baseline');
136
- setCurrentMethodIndex(0);
137
- }
138
  };
139
 
140
  return (
@@ -152,7 +114,7 @@ const BenchmarkChart = () => {
152
  {/* Control Button */}
153
  <div className="flex justify-center">
154
  <button
155
- onClick={handleManualAnimate}
156
  className="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-semibold transition-colors"
157
  >
158
  {currentPhase === 'baseline' ? 'Show Transformation Impact' : 'Reset to Baseline'}
@@ -216,10 +178,10 @@ const BenchmarkChart = () => {
216
 
217
  {/* Extension Bar (Green) - Only rounded at the end */}
218
  <div
219
- className="absolute top-0 h-full bg-gradient-to-r from-green-500 to-green-600 rounded-r-full transition-all duration-2000 ease-out"
220
  style={{
221
  left: `${baselineWidth}%`,
222
- width: currentPhase === 'additive_synthesis' && currentMethodIndex > 0 ? `${extensionWidth}%` : '0%'
223
  }}
224
  />
225
  </div>
 
25
  root_problem: 67.19
26
  }
27
  },
 
 
 
 
 
 
 
28
  {
29
  model: "Mixtral 8x22B",
30
  baseline: 48.00,
 
39
  keyword_objective_combined: 56.46
40
  }
41
  },
42
+ {
43
+ model: "Gemini 3",
44
+ baseline: 32.50,
45
+ methods: {
46
+ bio_topic_change: 53.68
47
+ }
48
+ },
49
  {
50
  model: "Claude 4 Sonnet",
51
  baseline: 26.33,
 
78
  ];
79
 
80
  const [currentPhase, setCurrentPhase] = useState('baseline');
 
 
 
81
 
82
  const getCurrentValue = (modelData, phase) => {
83
  if (phase === 'baseline') {
84
  return modelData.baseline;
85
+ } else if (phase === 'transformation') {
86
+ // Return the maximum value from all available transformation methods
87
  let maxASR = modelData.baseline;
88
 
89
+ Object.values(modelData.methods).forEach(value => {
90
+ maxASR = Math.max(maxASR, value);
91
+ });
 
 
 
92
 
93
  return maxASR;
94
  }
95
  return 0;
96
  };
97
 
98
+ const handleToggle = () => {
99
+ setCurrentPhase(currentPhase === 'baseline' ? 'transformation' : 'baseline');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  };
101
 
102
  return (
 
114
  {/* Control Button */}
115
  <div className="flex justify-center">
116
  <button
117
+ onClick={handleToggle}
118
  className="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg font-semibold transition-colors"
119
  >
120
  {currentPhase === 'baseline' ? 'Show Transformation Impact' : 'Reset to Baseline'}
 
178
 
179
  {/* Extension Bar (Green) - Only rounded at the end */}
180
  <div
181
+ className="absolute top-0 h-full bg-gradient-to-r from-green-500 to-green-600 rounded-r-full transition-all duration-1000 ease-out"
182
  style={{
183
  left: `${baselineWidth}%`,
184
+ width: currentPhase === 'transformation' ? `${extensionWidth}%` : '0%'
185
  }}
186
  />
187
  </div>