Spaces:
Sleeping
Sleeping
evolution-bot commited on
Commit ·
e3ceda6
1
Parent(s): e120c2a
evolve: mutation accepted 2026-07-01
Browse files- evolution/attempts.log +2 -0
- static/app_v30.js +77 -12
evolution/attempts.log
CHANGED
|
@@ -21,3 +21,5 @@
|
|
| 21 |
2026-06-28T07:05:44.746590+00:00 | SKIPPED | static/globe_patch.js: LLM HTTP error 402
|
| 22 |
2026-06-29T08:19:57.519985+00:00 | SKIPPED | static/index.html: LLM HTTP error 402
|
| 23 |
2026-06-30T06:59:05.195251+00:00 | SKIPPED | main.py: LLM HTTP error 402
|
|
|
|
|
|
|
|
|
| 21 |
2026-06-28T07:05:44.746590+00:00 | SKIPPED | static/globe_patch.js: LLM HTTP error 402
|
| 22 |
2026-06-29T08:19:57.519985+00:00 | SKIPPED | static/index.html: LLM HTTP error 402
|
| 23 |
2026-06-30T06:59:05.195251+00:00 | SKIPPED | main.py: LLM HTTP error 402
|
| 24 |
+
2026-07-01T07:16:35.174825+00:00 | PROPOSED | static/app_v30.js: 1 edit(s) applied; CI will validate
|
| 25 |
+
2026-07-01T07:16:37+00:00 | MERGED | tests passed
|
static/app_v30.js
CHANGED
|
@@ -22,23 +22,88 @@ function apiWithSignal(path, opts = {}) {
|
|
| 22 |
|
| 23 |
// === MATH ===
|
| 24 |
const M = {
|
| 25 |
-
mean: a =>
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
pearson: (x, y) => {
|
| 28 |
-
const n = x.length;
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
},
|
| 33 |
-
normalize: (v, arr) => { const mn = Math.min(...arr), mx = Math.max(...arr); return mx === mn ? 0.5 : (v - mn) / (mx - mn); },
|
| 34 |
-
percentile: (v, arr) => { let c = 0; for (let x of arr) if (x <= v) c++; return arr.length ? c / arr.length * 100 : 50; },
|
| 35 |
zscore: (v, arr) => { const m = M.mean(arr), s = M.std(arr); return s === 0 ? 0 : (v - m) / s; }
|
| 36 |
};
|
| 37 |
-
function vals(key, data = dataset) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
function getCorrelations(key, data = dataset) {
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
}
|
| 43 |
function corrStrength(r) { const a = Math.abs(r); return a >= 0.9 ? 'Very Strong' : a >= 0.7 ? 'Strong' : a >= 0.5 ? 'Moderate' : a >= 0.3 ? 'Weak' : 'Negligible'; }
|
| 44 |
let _abortController = null;
|
|
|
|
| 22 |
|
| 23 |
// === MATH ===
|
| 24 |
const M = {
|
| 25 |
+
mean: a => {
|
| 26 |
+
let sum = 0, len = a.length;
|
| 27 |
+
if (len === 0) return 0;
|
| 28 |
+
for (let i = 0; i < len; i++) sum += a[i];
|
| 29 |
+
return sum / len;
|
| 30 |
+
},
|
| 31 |
+
std: a => {
|
| 32 |
+
const len = a.length;
|
| 33 |
+
if (len < 2) return 0;
|
| 34 |
+
const m = M.mean(a);
|
| 35 |
+
let sum = 0;
|
| 36 |
+
for (let i = 0; i < len; i++) {
|
| 37 |
+
const diff = a[i] - m;
|
| 38 |
+
sum += diff * diff;
|
| 39 |
+
}
|
| 40 |
+
return Math.sqrt(sum / (len - 1));
|
| 41 |
+
},
|
| 42 |
pearson: (x, y) => {
|
| 43 |
+
const n = x.length;
|
| 44 |
+
if (n < 2 || n !== y.length) return 0;
|
| 45 |
+
let sumX = 0, sumY = 0, sumXY = 0, sumX2 = 0, sumY2 = 0;
|
| 46 |
+
for (let i = 0; i < n; i++) {
|
| 47 |
+
const xi = x[i], yi = y[i];
|
| 48 |
+
sumX += xi;
|
| 49 |
+
sumY += yi;
|
| 50 |
+
sumXY += xi * yi;
|
| 51 |
+
sumX2 += xi * xi;
|
| 52 |
+
sumY2 += yi * yi;
|
| 53 |
+
}
|
| 54 |
+
const mx = sumX / n, my = sumY / n;
|
| 55 |
+
const num = sumXY - n * mx * my;
|
| 56 |
+
const den = Math.sqrt((sumX2 - n * mx * mx) * (sumY2 - n * my * my));
|
| 57 |
+
return den === 0 ? 0 : num / den;
|
| 58 |
+
},
|
| 59 |
+
normalize: (v, arr) => {
|
| 60 |
+
if (arr.length === 0) return 0.5;
|
| 61 |
+
let mn = arr[0], mx = arr[0];
|
| 62 |
+
for (let i = 1; i < arr.length; i++) {
|
| 63 |
+
const val = arr[i];
|
| 64 |
+
if (val < mn) mn = val;
|
| 65 |
+
if (val > mx) mx = val;
|
| 66 |
+
}
|
| 67 |
+
return mx === mn ? 0.5 : (v - mn) / (mx - mn);
|
| 68 |
+
},
|
| 69 |
+
percentile: (v, arr) => {
|
| 70 |
+
if (arr.length === 0) return 50;
|
| 71 |
+
let c = 0;
|
| 72 |
+
for (let i = 0; i < arr.length; i++) if (arr[i] <= v) c++;
|
| 73 |
+
return c / arr.length * 100;
|
| 74 |
},
|
|
|
|
|
|
|
| 75 |
zscore: (v, arr) => { const m = M.mean(arr), s = M.std(arr); return s === 0 ? 0 : (v - m) / s; }
|
| 76 |
};
|
| 77 |
+
function vals(key, data = dataset) {
|
| 78 |
+
const result = [];
|
| 79 |
+
for (let i = 0; i < data.length; i++) {
|
| 80 |
+
const val = data[i][key];
|
| 81 |
+
if (val != null && !isNaN(val)) result.push(val);
|
| 82 |
+
}
|
| 83 |
+
return result;
|
| 84 |
+
}
|
| 85 |
function getCorrelations(key, data = dataset) {
|
| 86 |
+
const validVars = [];
|
| 87 |
+
for (let i = 0; i < variableDefs.length; i++) {
|
| 88 |
+
const v = variableDefs[i];
|
| 89 |
+
if (v.key !== key) {
|
| 90 |
+
for (let j = 0; j < data.length; j++) {
|
| 91 |
+
if (data[j][v.key] != null) {
|
| 92 |
+
validVars.push(v);
|
| 93 |
+
break;
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
const correlations = [];
|
| 99 |
+
const keyVals = vals(key, data);
|
| 100 |
+
for (let i = 0; i < validVars.length; i++) {
|
| 101 |
+
const v = validVars[i];
|
| 102 |
+
const vVals = vals(v.key, data);
|
| 103 |
+
const r = M.pearson(keyVals, vVals);
|
| 104 |
+
if (!isNaN(r)) correlations.push({ ...v, r });
|
| 105 |
+
}
|
| 106 |
+
return correlations.sort((a, b) => Math.abs(b.r) - Math.abs(a.r));
|
| 107 |
}
|
| 108 |
function corrStrength(r) { const a = Math.abs(r); return a >= 0.9 ? 'Very Strong' : a >= 0.7 ? 'Strong' : a >= 0.5 ? 'Moderate' : a >= 0.3 ? 'Weak' : 'Negligible'; }
|
| 109 |
let _abortController = null;
|