liveBook · Manning

COPOD

As explained in Outlier Detection in Python

COPOD is a copula-based outlier-detection algorithm that uses empirical copulas and tail probabilities to score observations without assuming a parametric data distribution.

COPOD is a parameter-free, distribution-free outlier detector that models feature marginals with empirical cumulative distribution functions, combines them into an empirical copula, and scores records by tail probability. It avoids distance calculations, scales to many features, adjusts probabilities for dimensionality and skew, and provides record-level explanations. section 6.4

COPOD follows three main steps:

  • Computes an empirical cumulative distribution function for each feature. section 6.4
  • Builds an empirical copula that represents the training data's joint distribution while retaining marginal distributions. section 6.4
  • Estimates how likely each record is to contain an unusually extreme combination of low or high values, then uses tail probability as the outlier signal. section 6.4

Synthetic two-feature example

Fit COPOD to 1,000 normally distributed observations in two columns after setting the final row's first feature to 15. Calling explain_outlier(999) identifies the extreme first feature while distinguishing the ordinary second feature. section 6.4

Listing 6.8 Example of COPOD with synthetic data
import pandas as pd
import numpy as np
from pyod.models.copod import COPOD
 
np.random.seed(42)
a_data = np.random.normal(loc=10, scale=1.0, size=1000) 
b_data = np.random.normal(loc=10, scale=1.0, size=1000)
df = pd.DataFrame({“A”: a_data, “B”: b_data})
df.loc[999, 'A'] = 15
 
clf = COPOD()  
clf.fit(df)
clf.explain_outlier(999)

Use the compact PyOD listing to inspect fitting and record-level explanation on synthetic data. section 6.4

How Outlier Detection in Python covers it

How deep it goes
Explains empirical marginals, copula construction, dimensional adjustment, skew correction, and record-level scoring, without deriving the underlying mathematics.
Examples
Demonstrates synthetic two-feature data and compares a speech-dataset result with ECOD, including record-level explanations.
What you can do after
Apply it via PyOD by fitting COPOD and inspecting per-record outlier explanations.
How it connects
Connects empirical cumulative distributions with copulas, tail probabilities, ECOD, and unsupervised outlier detection.

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.