Public
Edited
Jul 24, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
let weight = 0.5;
for (let i = 1; i <= iterations; i++) {
let prediction = input * weight;
let error = Math.pow(prediction - goal, 2);
let directionAndAmount = (prediction - goal) * input;
weight = weight - directionAndAmount;

yield html`
Iteration:${i}<br>
Weight: ${weight}<br>
Error: ${error}<br>
Prediction: ${prediction}
`;
}
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more