tensorturnBETA
HomeUse Cases

How to Build an Anomaly Detection Model Without Code

You can build an anomaly detection model in TensorTurn two ways depending on your labels: with no labeled anomalies, it trains an unsupervised scikit-learn detector (Isolation Forest or One-Class SVM) that scores how unusual each record is; with some confirmed anomalies, it trains a class-weighted classifier (XGBoost or scikit-learn) like a rare-event problem. Either way you upload your data, describe the goal in chat, it runs on a cloud GPU, and it deploys a /predict API that returns an anomaly score you threshold to flag outliers. The health check's built-in outlier and correlation analysis is a useful first look before you train anything.

Two paths: labeled vs. unlabeled

The right approach hinges on whether you have examples of the anomaly. Unlabeled (the common case): you only have normal-looking data and want to flag whatever deviates, so Isolation Forest or One-Class SVM learn the shape of 'normal' and score how far each record sits from it. Labeled (you have confirmed failures, intrusions or defects): this is imbalanced classification, where a class-weighted XGBoost or scikit-learn model learns the anomaly directly and usually beats unsupervised methods. Many teams start unsupervised, review the flags, and graduate to supervised once they have collected confirmed labels.

What data you need

SituationLikely algorithmHow it's evaluated
No labels at allIsolation Forest / One-Class SVM (scikit-learn)review flagged cases, precision@k, sanity checks
Some confirmed anomaliesclass-weighted XGBoost / scikit-learnPR-AUC, recall at a fixed precision, confusion matrix
Time-based signalsfeatures over rolling windowssame metrics, tested on later time periods

How to build an anomaly detection model with TensorTurn (no code)

How it's evaluated (this is the hard part)

Evaluation is straightforward when you have labels — use PR-AUC and recall at a fixed precision, exactly like a rare-event classifier, and validate on later time periods so you are not testing on the same past you trained on. When you have no labels, there is no ground truth, so evaluation is judgment: you set a threshold, review the top-scored records, and confirm whether they are genuinely unusual or just rare-but-fine. This is inherently iterative — expect to adjust the threshold and features as you learn what 'anomaly' actually means for your data.

Honest limits

Unsupervised detectors flag statistical outliers, which are not always the anomalies you care about — a legitimate but rare event looks identical to a real problem. They cannot tell you why something is anomalous beyond feature importance, and they drift as normal behavior changes, so retrain periodically. If your anomaly is well-defined and you can label it, a supervised model is almost always more accurate; treat unsupervised detection as a starting point that helps you collect those labels. For financial fraud specifically, the dedicated fraud-detection guide goes deeper on the labeled, imbalanced case.

Deploy as an API

Publish an authenticated /predict endpoint on Modal with a SHA-256-hashed Bearer key, per-call logging and scale-to-zero. Stream each new record to the endpoint, compare the returned anomaly score to your threshold, and route it to alert, hold or ignore. The playground gives cURL, JavaScript, Python and Rust snippets.

Start building free

Frequently asked questions

Do I need labeled anomalies?

No. Without labels, TensorTurn trains an unsupervised Isolation Forest or One-Class SVM. With labels, it trains a more accurate class-weighted classifier. Just say which you have in chat.

Which algorithm will it use?

Isolation Forest or One-Class SVM (scikit-learn) when unlabeled; XGBoost or a scikit-learn classifier with class weighting when you have confirmed anomalies.

How do I evaluate it without labels?

By review: set a threshold, inspect the top-scored records, and confirm they are truly unusual. It is iterative, and there is no accuracy number without ground truth.

How is this different from fraud detection?

Fraud detection is a labeled, imbalanced classification problem on transactions. Anomaly detection also covers the unlabeled case and spans sensors, networks and equipment, not just payments.

How often should I retrain?

Whenever normal behavior shifts. Detectors drift as your system changes, so refresh on recent data and, ideally, on newly confirmed anomalies.

Can I use my own GPU?

Yes. Connect one machine, or pool several of your own, with a one-line, outbound-HTTPS-only command that works behind any firewall.