Skip to content

Commit

Permalink
Use the average of "c" values in SPSA chart
Browse files Browse the repository at this point in the history
  • Loading branch information
ppigazzini committed Jan 23, 2025
1 parent b3f6856 commit d155b41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions server/fishtest/static/js/spsa.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,14 @@ async function handleSPSA() {
data.push(gaussianKernelRegression(raw[j], bandwidth));
}
let googleFormat = [];
let sumC = Array(spsaParams.length).fill(0);
for (let i = 0; i < spsaHistory.length; i++) {
let rowData = [(i / (spsaHistory.length - 1)) * spsaIterRatio];
for (let j = 0; j < spsaParams.length; j++) {
sumC[j] += spsaHistory[i][j].c;
const avgC = sumC[j] / (i + 1);
if (usePercentage) {
rowData.push(
(data[j][i] - spsaParams[j].start) / spsaParams[j].c_end,
);
rowData.push((data[j][i] - spsaParams[j].start) / avgC);
} else {
rowData.push(data[j][i]);
}
Expand Down Expand Up @@ -239,13 +240,14 @@ async function handleSPSA() {
for (let i = 0; i < smoothingMax; i++) dataCache.percentage.push(false);

let googleFormat = [];
let sumC = Array(spsaParams.length).fill(0);
for (let i = 0; i < spsaHistory.length; i++) {
let rowData = [(i / (spsaHistory.length - 1)) * spsaIterRatio];
for (let j = 0; j < spsaParams.length; j++) {
sumC[j] += spsaHistory[i][j].c;
const avgC = sumC[j] / (i + 1);
if (usePercentage) {
rowData.push(
(spsaHistory[i][j].theta - spsaParams[j].start) / spsaParams[j].c_end,
);
rowData.push((spsaHistory[i][j].theta - spsaParams[j].start) / avgC);
} else {
rowData.push(spsaHistory[i][j].theta);
}
Expand Down
2 changes: 1 addition & 1 deletion server/fishtest/templates/tests_view.mak
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
id="spsa_percentage"
name="spsa-percentage"
/>
<label class="form-check-label" for="spsa_percentage">c_end %</label>
<label class="form-check-label" for="spsa_percentage">% c</label>
</div>
</div>
<div class="overflow-auto">
Expand Down

0 comments on commit d155b41

Please sign in to comment.