From 8aa2338b35a96901efbf735b36576296ca683c3a Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Tue, 18 Nov 2025 12:01:10 -0800 Subject: [PATCH] Feat: Calculate optimal temperature using weighted mean of correctness --- gemini.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gemini.html b/gemini.html index 1551581..c0701d6 100644 --- a/gemini.html +++ b/gemini.html @@ -30,11 +30,13 @@ const genTimes=await fetch('./results.json').then(r=>r.json()); const models=readme.match(/\n([\s\S]+?)\n/)[1].trim().split('\n').filter(Boolean); const tests=[...new Set(Object.values(genTimes).flatMap(Object.keys))].sort(); - const tStats={}; + let [wSum, wTot] = [0, 0]; for(const model of models){ const sModel=model.replace(/[\/:]/g,'_'); - const temp=model.split('TEMP:')[1]?.trim(); + const tStr=model.split('TEMP:')[1]; + const tVal=tStr?parseFloat(tStr):NaN; + const card=document.createElement('section'); card.className='rounded-2xl border border-gray-200 bg-white shadow-sm overflow-hidden'; card.innerHTML=`

${model}

`; @@ -67,18 +69,18 @@ li.innerHTML=`${status} ${test}${time.toFixed(3)}s`; } const ratio=tests.length?passed/tests.length:0; - if(temp){tStats[temp]??={p:0,t:0};tStats[temp].p+=passed;tStats[temp].t+=tests.length} + if(!isNaN(tVal)){wSum+=tVal*ratio;wTot+=ratio;} const grade=gradeOf(ratio); const scoreLi=document.createElement('li'); scoreLi.className='mt-3 pt-3 border-t border-gray-200 flex items-center text-sm justify-between'; scoreLi.innerHTML=`Score${passed}/${tests.length}${grade}`; list.appendChild(scoreLi); } - if(Object.keys(tStats).length){ - const best=Object.entries(tStats).sort(([,a],[,b])=>b.p/b.t-a.p/a.t)[0]; + if(wTot>0){ + const optimal=(wSum/wTot).toFixed(4); const statDiv=document.createElement('div'); statDiv.className='mt-8 p-6 bg-white rounded-2xl border border-gray-200 shadow-sm text-center'; - statDiv.innerHTML=`

Best Temperature

${best[0]}
Pass Rate: ${((best[1].p/best[1].t)*100).toFixed(1)}%
`; + statDiv.innerHTML=`

Optimal Temperature

${optimal}
Weighted Center of Correctness
`; container.appendChild(statDiv); } })();