Lab

Each experiment answers one method question and shows when the method works and when it can mislead. It runs on synthetic data; the computation happens in this browser with WebAssembly.

Lab in half a minute

A short narrated tour: how to use the seven experiments, how to read a threshold and where to start.

Read the transcript

Lab is a playground for the methods behind industrial AI. Pit five anomaly detectors against the same data, and see which one catches the spike, the drift, or the shift. Slide the threshold, and watch the trade-off between false alarms and missed events. Explore OEE, process capability, PID tuning, aliasing and forecasts, each with a plain verdict. It runs in C and WebAssembly, in your browser. The data is synthetic: methods, not field accuracy.

Narration: synthetic voice (Piper, voice “Joe”, CC0 public domain). Captions are burned into the video.

In three steps.

1

Pick an experiment

Seven experiments sit on one page. Choose one from the navigator or scroll through them.

2

Move a control

Change a scenario, threshold, setting or frequency; the result updates at once.

3

Read the result

The verdict, the chart and the numbers answer the same question. Each experiment states its limits in a note.

1

Which detector should I trust?

Shows how many of four kinds of anomaly five methods catch on the same synthetic series; the true labels are known, so it can be measured.

Scenario

All are synthetic. The test part is the last half of the series.

1
1

1 is balanced. Raising it makes the methods alarm sooner, and the number of alarms grows.

Computing…

Value series and true anomalies

Shaded areas are the true events.

Method lanes

A red cell is an alarm. The top lane shows the true events.

F1 by method

A high F1 means precision and recall are both good.

Precision, recall and F1 per method
Method
  1. 1What is measured? The alarms of five methods on the same series. A red cell is an alarm; the top lane is the true event.
  2. 2Which number matters? F1 combines precision and recall. High precision means few false alarms; high recall means few missed events.
  3. 3When does a method fail? For drift and level shifts, single readings can look normal; methods that accumulate change are the ones that warn early.
The maths, if you want it
Robust z = |x − median| / (1.4826 × MAD), computed on the training part. Regression residual: least-squares line on the training part; residual / residual standard deviation. EWMA and CUSUM work on the residuals of a “line + one cycle” model fitted on the training part; the cycle length (8–120 samples) is chosen on the training part. Isolation Forest: 100 trees, sample size 128; the threshold is the 99th percentile of training scores. Sensitivity scales each limit against its nominal value.

Precision = TP / (TP + FP), recall = TP / (TP + FN), F1 = 2TP / (2TP + FP + FN). Counts use the test part only.

2

More alerts, better results?

Move one method’s alarm threshold and watch the trade-off between false alarms and missed events.

The series and scenario come from experiment 1; this experiment uses the same series.

—

The threshold is in the method’s own score units. Moving right makes alarms harder to raise.

Computing…

–

Up and to the right is better. The marked point is the current threshold.

F1 against threshold

The peak is the threshold with the best F1.

Here the threshold is chosen on the same test part, so the result is optimistic. For a real final test, choose the threshold on a separate part and run the final test once.

  1. 1What does the threshold do? Raising it reduces alarms. False alarms fall, but real events start to be missed.
  2. 2Where is the peak? The F1 peak is the threshold where precision and recall balance best. Check it on a genuinely separate test.
  3. 3What do the four boxes say? Real events caught, false alarms, missed events and quiet-and-correct rows. Together they add up to the number of test rows.
The maths, if you want it

For a threshold t, alarm: score > t. TP, FP, FN and TN are counted for each t; precision, recall and F1 follow. If there is no alarm, precision is undefined and is not drawn.

3

Where did the OEE go?

Shows how much of the planned time became good output, and in which order the losses occur.

Defaults: 480 minutes planned, 420 minutes running, 2 s ideal cycle.

Computing…

Loss waterfall

Starts at planned time and subtracts each loss in turn; what remains is OEE.

OEE

The needle shows the OEE value; colours mark the 60 and 85% bands.

The 85% line is an often-quoted benchmark, not your target.

  1. 1Loss order Stops are subtracted first, then speed loss, then quality loss. Each bar is the size of one loss.
  2. 2Biggest loss The sentence under the verdict names the largest loss. Start there when you want more OEE.
  3. 3What about 85 %? It is an often-quoted benchmark. The right target for your process and product may be different.
The maths, if you want it

A = run / planned time · P = (ideal cycle × total count) / (run time × 60) · Q = good / total count · OEE = A × P × Q.

If performance exceeds 100%, the ideal cycle time or the count may be wrong. The value is not clipped; check the inputs.

4

Does the process fit the tolerance?

Compares the spread of measurements with the specification limits and computes Cp, Cpk, Pp and Ppk.

My own measurements

One measurement per line. Decimal comma accepted. At least 20 measurements.

Computing…

Distribution and spec limits

Red bars are outside specification. The dashed curve is the normal distribution.

  1. 1Cp versus Cpk Cp looks at width only. Cpk also counts how close the mean is to a limit; the gap between them shows shift.
  2. 2Where does 1.33 come from? It is a commonly used target. Your customer or standard may ask for a different value.
  3. 3Normality If the distribution is not normal, the Cp and ppm estimates can be rough; the Jarque–Bera p value flags this.
The maths, if you want it

Cp = (USL − LSL) / (6σw) · Cpk = min(USL − μ, μ − LSL) / (3σw) · Pp and Ppk are the same formulas with the overall σ.

σw is estimated from the moving range of consecutive measurements (MR / 1.128). Normality is checked with the Jarque–Bera test; if p is low, the Cp and ppm estimates may be rough.

5

How does a control loop react?

Shows how a simple process settles under a PID controller; change the settings or ask for a suggestion.

Presets

2.2
5 s
0 s

Process

1
8 s
1 s

Computing…

Process value

The dashed line is the expected response if the suggestion is applied.

Controller output

The output is limited between 0% and 100%.

  1. 1Three settings Kp speeds up the response, Ti removes the steady error, Td damps the swing. Changing one changes the others’ effect.
  2. 2Overshoot and ringing Overshoot is going above the target. If it repeats, the loop rings; watch how long it takes to settle.
  3. 3Load disturbance A load added halfway tests how well the controller recovers. The recovery time measures that.
The maths, if you want it

Process: τ·dy/dt = −y + K·u(t − θ), first order with dead time. Controller: u = Kp·e + (Kp/Ti)·∫e dt + Kp·Td·de/dt, limited to 0–100%. Target 50%.

IAE = ∫|target − process value| dt (lower = better). The suggestion searches a Kp × Ti × Td grid (11 × 5 × 2, at most 110 simulations) for the setting with the lowest IAE and overshoot under 20%. It holds only for this process model.

6

Why does fast vibration look slow?

Shows that sampling a signal at a fixed rate can make it appear at a wrong frequency.

A one-second record. The sampling rate fs is the number of samples per second.

60 Hz
50 Hz

Computing…

Signal and samples

Dots are samples; the line passes through them.

Apparent frequency

Where the true frequency and the Nyquist limit sit.

  1. 1Nyquist limit Half the sampling rate. Frequencies below it are followed correctly; those above appear shifted.
  2. 2Apparent frequency The frequency you would read from the samples. If it differs from the true one, sampling is too slow.
  3. 3Fix Raise the sampling rate, or low-pass filter the signal before sampling.
The maths, if you want it

Nyquist limit = fs / 2. Apparent frequency = |f − round(f / fs) · fs|. If f < fs/2, the apparent frequency is f itself.

Samples are taken at t = k / fs. The experiment shows the sampling effect of one channel; it does not model an anti-aliasing filter.

7

Does the clever model beat the simple one?

Forecasts a seasonal series with three simple and two more complex methods and compares their errors on the test part.

2
Forecasts to show

The series is 240 hours: the first 192 are training and the last 48 are the test.

Computing…

Series and forecasts

The vertical line separates training from testing. Lines beyond the chart are clipped.

MAE

A shorter bar is better.

Error table

MethodMAE
  1. 1The baseline Seasonal naive repeats the value of one day earlier. It is the bar to clear.
  2. 2MAE and MASE MAE is the mean absolute error. MASE divides it by the error of a naive forecast on training data; below 1 beats the naive forecast.
  3. 3One window The test is one 48-hour window. Look at other periods before saying a result holds in general.
The maths, if you want it

Naive: last training value. Seasonal naive: the value 24 hours earlier. 24-hour average: mean of the last 24 training values.

Holt: over a grid of α, β, φ (7 × 4 × 4), the values minimising one-step MAE; forecast l + b·(φ + … + φh). Kalman: KutupML.trendFit by maximum likelihood; forecast level + slope × h.

MASE = MAE / (mean absolute error of the naive forecast in training). Holt and Kalman do not model seasonality; the Kalman slope can follow the cycle, which is why it can drift off.

How do I read the result?

  1. 1What do I look at? Each experiment asks its own question. You do not need to read the page from top to bottom; start with the experiment you care about.
  2. 2What do threshold and sensitivity do? Both change how quickly a method raises an alarm. When you raise one, precision and recall move together; read them as a pair.
  3. 3Is a high score enough? A high F1 means a good fit on a synthetic scenario. One measurement like this does not replace field evidence.
  4. 4Use the baseline as the reference Naive, seasonal naive and the robust z-score are always the reference. A new method stands out only if it beats them.
Lab works with synthetic data. The results show how the methods behave; they do not measure how well real faults are caught, and they are not fault diagnoses. Before using a method on real data, verify it on your own labelled test part.

Frequently asked

What is Lab for?

It shows common engineering and data methods in small experiments where you can see when each works and when it can mislead: anomaly detectors, alarm thresholds, OEE, process capability, PID control, sampling and forecasting.

Are the data in the experiments real?

No. Every series is generated mathematically and stays the same on each visit (fixed seed). They do not represent a real plant; they only show how the methods behave.

Why are synthetic spikes easier to find than real events?

An artificial spike is exactly as clear as it was designed to be. Real data add sensor noise, maintenance effects and missing values, which make the task harder. A good score in an experiment should therefore be read as an upper bound for the field.

Does Lab upload anything?

No. Calculations, charts and exported files run in your browser. Numbers you paste are not sent to any server, and they are removed when you close the page.

Why compare every method with a simple baseline?

A complex model adds nothing unless it beats a simple rule. Baselines such as seasonal naive or the robust z-score are cheap and easy to explain; a new method earns its place only if it beats them with a lower error.

Go deeper.

Full library

Related questions

All questions
ASP Dijital

Start with a production problem.

Let’s review your data source, your existing system and the decision you want to improve.

Discuss your project ↗