Configure the histogram
Enter direct errors or calculate them from paired feature rows.
Formula used
Mean squared reconstruction error
The formula averages squared feature differences for each observation.
Mean absolute reconstruction error
Absolute error reduces the influence of isolated large differences.
Automatic thresholds
An observation becomes anomalous when its score exceeds the threshold.
How to use this calculator
- Choose direct errors or paired original and reconstructed rows.
- Select an error metric when using paired feature data.
- Choose optional scaling for cross-dataset score comparison.
- Select an automatic or manual histogram bin rule.
- Choose a threshold method and enter its required setting.
- Press the calculation button to view results above.
- Review flagged observations and export scored rows when needed.
Understanding reconstruction error histograms
Core interpretation
Reconstruction error measures how closely a model rebuilds each individual observed sample. Small errors typically usually indicate familiar patterns learned during training. Large errors can reveal unusual, corrupted, or previously unseen operational behavior.
A histogram groups error values into contiguous ranges called bins. Its shape shows concentration, spread, skewness, and possible meaningful secondary clusters. These patterns often expose model limitations hidden by simple average scores.
Metric selection
Autoencoders commonly minimize mean squared error during careful model training. Other systems may use absolute error or maximum individual feature deviation. The selected metric should match data scale and practical operational consequences.
Mean squared error strongly emphasizes occasional large reconstruction value differences. Mean absolute error provides steadier behavior around isolated extreme input values. Root mean squared error returns results toward original measurement units.
Threshold strategies
Thresholds separate expected reconstructions from suspicious high-error observations. A percentile threshold labels the largest chosen error proportion. Mean-plus-deviation rules work best with roughly symmetric distributions.
Median and MAD thresholds resist distortion from extreme observations. This method often performs better with skewed or contaminated validation data. Manual thresholds remain useful when business costs determine acceptable risk.
Histogram design
Bin selection changes how visible distribution details become. Too few bins can conceal shoulders, gaps, or multiple populations. Too many bins can create noisy patterns without reliable meaning.
Sturges selection suits moderate samples with uncomplicated distributions. Square-root selection offers a simple balance for exploratory inspection. Freedman-Diaconis adapts bin width using sample size and IQR.
Reliable evaluation
Always estimate thresholds using representative normal validation samples. Mixing confirmed anomalies can push automatic thresholds dangerously upward. Separate threshold tuning from final performance evaluation whenever possible.
Review flagged rows beside original features and reconstructed outputs. High error alone does not prove malicious or faulty behavior. Context determines whether each alert requires investigation or dismissal.
Operational monitoring
Compare anomaly rates across time, segments, devices, and model versions. Sudden shifts may indicate drift, broken preprocessing, or pipeline changes. Stable monitoring makes reconstruction scores more operationally useful.
Document the metric, threshold rule, dataset, and evaluation date. Recalculate settings after meaningful model or feature changes. Careful governance turns histogram analysis into dependable anomaly screening.
Scaling and tails
Feature scaling directly affects which variables dominate reconstruction error. Standardization can prevent large-unit features from overwhelming smaller measurements. Apply identical transformations during training, validation, and production scoring.
A right-skewed histogram is common for mostly normal observations. Long tails may contain legitimate edge cases and true anomalies. Inspect tails before assigning every extreme score equal priority.
Frequently asked questions
What is reconstruction error?
Reconstruction error measures differences between original inputs and model outputs. Lower scores usually represent familiar patterns. Higher scores may indicate anomalies, corruption, drift, or weak reconstruction quality.
Which error metric should I choose?
Use MSE when large deviations deserve stronger penalties. Choose MAE for steadier resistance against extreme differences. RMSE keeps squared sensitivity while returning closer measurement units.
Why use a histogram?
A histogram reveals score concentration, spread, tails, and multiple groups. These patterns help assess threshold quality. They also expose distribution shifts that averages can hide.
What percentile works best?
Common starting values range from ninety-five through ninety-nine. The correct choice depends on anomaly prevalence and review capacity. Validate several percentiles using labeled examples whenever possible.
When is the MAD threshold useful?
MAD works well with skewed distributions or contaminated validation samples. It uses the median and absolute deviations. Extreme observations influence it less than standard deviation.
Should errors be normalized?
Normalize scores when comparing datasets with different scales. Avoid normalization when raw units carry operational meaning. Apply identical transformations during threshold tuning and deployment.
How many histogram bins are appropriate?
Automatic rules provide useful starting points. Freedman-Diaconis handles spread and sample size effectively. Manual bins help when domain reporting needs fixed intervals.
Does a high error confirm an anomaly?
No, a high score only signals unusual reconstruction. Legitimate edge cases may also produce large errors. Review context, labels, features, and downstream consequences.
How often should thresholds change?
Recalculate thresholds after meaningful model, data, or pipeline changes.