liveBook · Manning

DeepOD

As explained in Outlier Detection in Python

DeepOD is a Python library providing unsupervised and semisupervised outlier-detection algorithms for tabular and time-series data.

DeepOD is a Python library for unsupervised and semisupervised outlier detection on tabular and time-series data. It uses deep learning methods and includes 27 algorithms, with broader and more cutting-edge coverage than some overlapping tools. section 16.5.5 section 16.0

For tabular data, GOAD applies multiple affine transformations to each row and predicts which transformation occurred. Normal records should support accurate predictions; unusual records should produce poorer predictions and higher aggregated outlier scores. section 16.5.5

ICL uses subsets of features from each row to learn similar embeddings for views of the same object and different embeddings for other objects. This adapts contrastive learning to tabular anomaly detection. section 16.5.5 section 16.5.4

Listing 16.11 Using DeepOD’s GOAD with the KDD Cup dataset
from deepod.models.tabular import GOAD
 
clf = GOAD()
clf.fit(X)
scores = clf.decision_function(X)

A minimal GOAD workflow fits the detector to tabular data and obtains one decision score per record. section 16.5.5

Listing 16.12 Using DeepOD’s ICL with the KDD Cup dataset
from deepod.models.tabular import ICL
 
clf = ICL()
clf.fit(X)
scores = clf.decision_function(X)

A minimal ICL workflow uses the same fit-and-score pattern for tabular anomaly detection. section 16.5.5

For time series, DeepOD provides specialized methods including TimesNet, Deep Isolation Forest, and Deep SVDD. TimesNet expands one-dimensional series into a two-dimensional representation and can model multiple periodicities. section 17.3.2

UPS mentions on Twitter

TimesNet scores a Twitter volume series, then highlights records above 1,000. Larger values receive many flags, while moderate values may reflect seasonality or sharp differences from preceding values. section 17.3.2

Listing 17.17 Using TimesNet to detect outliers
import numpy as np
import pandas as pd
from deepod.models.time_series import TimesNet
import matplotlib.pyplot as plt
import seaborn as sns
 
df = pd.read_csv('Twitter_volume_UPS.csv')                     #1
df.index = df['timestamp']                                     #2
df = df.drop(columns=['timestamp'])
 
clf = TimesNet()                                               #3
clf.fit(df)
scores = clf.decision_function(df)
 
df['x'] = range(len(df))                                       #4
df1 = df.loc[scores<=1000]
df2 = df.loc[scores>1000]
 
sns.scatterplot(data=df1, x='x', y='value', color='blue', s=5) #5
sns.scatterplot(data=df2, x='x', y='value', marker="*", s=70, color='red')
plt.xticks([])
plt.show()

The TimesNet example shows data loading, fitting, scoring, thresholding, and plotting flagged time-series records. section 17.3.2

How Outlier Detection in Python covers it

How deep it goes
Explains transformation, embedding, and time-series representation logic with workflows, while deferring extensive theory and requiring substantial hardware.
Examples
Demonstrates GOAD and ICL on KDD Cup data and TimesNet on UPS mentions from Twitter.
What it assumes
Assumes Python data-handling familiarity and suitable tabular or time-series inputs; TimesNet additionally requires PyTorch, GPU access, and safer environment isolation.
What you can do after
Apply it via Python APIs to fit detectors, generate outlier scores, threshold records, and visualize flagged time-series points.
How it connects
Connects outlier detection with deep learning, self-supervised learning, contrastive learning, PyOD, and time-series modeling.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Outlier Detection in Python. The section links point to the parts of the book it draws on.