A comprehensive library for detecting anomalies in business data using statistical and machine learning approaches. Designed for fraud detection, system monitoring, data validation, and quality control.
For complete documentation, examples, and API reference, visit: danieleteti.it/delphianomalydetection
- 6 Detection Algorithms - Three Sigma, Sliding Window, EMA, Adaptive, Isolation Forest, DBSCAN
- Production Ready - Thread-safe, memory-efficient, thoroughly tested
- Real-time & Batch - Streaming data and historical analysis
- Easy Integration - Single unit, no external dependencies
- Performance Monitoring - Built-in metrics and benchmarking
- Hyperparameter Tuning - Grid/Random search with cross-validation
| Algorithm | Best For | Speed |
|---|---|---|
| Three Sigma | Quality control, baseline analysis | Fast |
| Sliding Window | Real-time monitoring, dashboards | Medium |
| EMA | Financial data, trending patterns | Very Fast |
| Adaptive | Evolving patterns, learning systems | Fast |
| Isolation Forest | Fraud detection, multi-dimensional | Medium |
| DBSCAN/LOF | Cluster-based anomalies | Slow |
uses
AnomalyDetection.Types,
AnomalyDetection.ThreeSigma,
AnomalyDetection.Factory;
var
Detector: IAnomalyDetector;
Result: TAnomalyResult;
begin
// Create detector
Detector := Factory.CreateDetector(adtThreeSigma, 'QualityControl');
// Add data and build
Detector.AddValues([100, 105, 98, 102, 107, 99, 103, 101]);
Detector.Build;
// Detect anomaly
Result := Detector.Detect(150);
if Result.IsAnomaly then
WriteLn('Anomaly detected! Z-score: ', Result.ZScore:0:2);
end;uses AnomalyDetection.SlidingWindow;
var
Detector: TSlidingWindowDetector;
begin
Detector := TSlidingWindowDetector.Create(100); // 100-value window
try
while HasIncomingData do
begin
Value := GetNextReading;
if Detector.IsAnomaly(Value) then
TriggerAlert('Spike detected: ' + Value.ToString);
Detector.AddValue(Value);
end;
finally
Detector.Free;
end;
end;uses AnomalyDetection.IsolationForest;
var
Detector: TIsolationForestDetector;
begin
Detector := TIsolationForestDetector.Create(100, 256, 5); // 100 trees, 5 features
try
// Train on normal transactions
for Transaction in NormalTransactions do
Detector.AddTrainingData([Amount, Hour, Day, Category, Age]);
Detector.Train;
// Detect fraud
Result := Detector.DetectMultiDimensional([5000, 3, 2, 5, 35]);
if Result.IsAnomaly then
FlagForReview('Suspicious transaction');
finally
Detector.Free;
end;
end;uses AnomalyDetection.Factory;
// Pre-configured detectors for common use cases
WebDetector := Factory.CreateForWebTrafficMonitoring;
FinanceDetector := Factory.CreateForFinancialData;
IoTDetector := Factory.CreateForIoTSensors;
FraudDetector := Factory.CreateForHighDimensionalData;Full documentation with all algorithms, examples, and tuning guide:
danieleteti.it/delphianomalydetection
- Download or clone from GitHub
- Add the
srcfolder to your Library Path - Add the appropriate units to your project
- Delphi 10.3 Rio or later
- No external dependencies
Apache 2.0 - Free for commercial and personal use.
- Training & Consulting: Bit Time Professionals
- Email: professionals@bittime.it
- Documentation: danieleteti.it/delphianomalydetection
- Issues: GitHub Issues
- Community: Facebook Group