import { Arrow, FILL, LoopFigure, type LoopStop } from "./LoopFigure";
const CX = [110, 280, 450, 620];
const INPUT_Y = [120, 200, 280, 360];
const HID_Y = [90, 165, 240, 315, 390];
const OUT_Y = [160, 240, 320];
const STOPS: LoopStop[] = [
{
x: CX[0],
y: 200,
ids: ["input"],
inspect: "input",
title: "Input layer",
note: "A fixed-size vector x. No notion of sequence — one snapshot of features.",
},
{
x: CX[1],
y: 240,
ids: ["hidden"],
inspect: "hidden",
title: "Hidden layer",
note: "h = σ(W₁x + b₁). Width buys capacity; the same map is used for every example.",
},
{
x: CX[2],
y: 240,
ids: ["hidden"],
inspect: "hidden",
title: "Deeper hidden layer",
note: "Stacking nonlinear maps gives universal approximation — still one-shot, still no memory.",
},
{
x: CX[3],
y: 240,
ids: ["output"],
inspect: "output",
title: "Output layer",
note: "y is class scores or a regression target. Then the loop restarts at a new x.",
},
{
x: CX[3],
y: 455,
ids: ["output"],
inspect: "output",
title: "Next example",
note: "Each forward pass is independent. Nothing is carried to the next input.",
},
{
x: CX[0],
y: 455,
ids: ["input"],
inspect: "input",
title: "Next example",
note: "A new vector x enters the same stack of weights.",
},
];
export function MlpLoop({ onSelect }: { onSelect: (id: string) => void }) {
return (
{({ on, markerId }) => (
Multilayer Perceptron
h = σ(Wx + b)
{INPUT_Y.map((y, i) =>
HID_Y.map((hy, j) => (
)),
)}
{HID_Y.map((y, i) =>
HID_Y.map((hy, j) => (
)),
)}
{HID_Y.map((y, i) =>
OUT_Y.map((oy, j) => (
)),
)}
{INPUT_Y.map((y, i) => (
))}
{HID_Y.map((y, i) => (
))}
{HID_Y.map((y, i) => (
))}
{OUT_Y.map((y, i) => (
))}
Input x
Hidden
Hidden
Output y
)}
);
}
function Neuron({
cx,
cy,
fill,
lit,
}: {
cx: number;
cy: number;
fill: string;
lit: boolean;
}) {
return (
);
}