20 lines
589 B
HTML
20 lines
589 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head><meta charset="utf-8"><title>symreg-rs WASM demo</title></head>
|
|
<body>
|
|
<h1>symreg-rs (WASM)</h1>
|
|
<button id="run">Run demo</button>
|
|
<pre id="out"></pre>
|
|
<script type="module">
|
|
import init, { fit_mse } from './pkg/symreg_rs_wasm.js';
|
|
await init();
|
|
document.getElementById('run').onclick = () => {
|
|
const xs = []; const ys = [];
|
|
for (let i=0;i<50;i++){ const v=i/10; xs.push(v); ys.push(Math.sin(v)); }
|
|
const preds = fit_mse(xs, 50, 1, ys, 10);
|
|
document.getElementById('out').textContent = JSON.stringify(preds.slice(0,10), null, 2);
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|