"use client"; import { motion } from "framer-motion"; import { COLORS, VizFrame } from "./common"; /** Single neuron with explicit x_i, w_i, b, Σ, σ, y. */ export function PerceptronDiagram({ width = 880, height = 380, }: { width?: number; height?: number; }) { const inputs = [ { label: "x₁", w: "w₁" }, { label: "x₂", w: "w₂" }, { label: "x₃", w: "w₃" }, ]; const padX = 80; const inputX = padX + 40; const sumX = width / 2 - 40; const actX = width / 2 + 80; const outX = width - padX - 40; const cy = height / 2; const inputYs = inputs.map((_, i) => cy - 80 + i * 80); return ( {/* Input nodes */} {inputs.map((inp, i) => ( {inp.label} ))} {/* Edges with weight labels */} {inputs.map((inp, i) => ( {inp.w} ))} {/* Bias */} 1 b {/* Σ node */} Σ z = Σ wᵢ xᵢ + b {/* Connection sum -> activation */} z {/* Activation node σ */} σ activation {/* Output */} y output {/* Top label of inputs */} inputs ); }