Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Drift Detection

Detect distribution shift between a reference dataset and a current one using the Kolmogorov-Smirnov two-sample test.

Python

import seraplot as sp
import json

result = json.loads(sp.drift(reference=ref_values, current=cur_values))
print(result)

Returns:

{
  "ok": true,
  "ks_statistic": 0.18,
  "p_value": 0.003,
  "drift_detected": true,
  "n_reference": 1000,
  "n_current": 1000
}

drift_detected is true when p_value < 0.05.

JavaScript

import { driftKs } from "seraplot";
const r = JSON.parse(driftKs(JSON.stringify({ reference, current })));

Détecte un drift de distribution entre un dataset de référence et un dataset actuel via le test à deux échantillons de Kolmogorov-Smirnov.

Python

import seraplot as sp
import json

result = json.loads(sp.drift(reference=ref_values, current=cur_values))
print(result)

Retourne :

{
  "ok": true,
  "ks_statistic": 0.18,
  "p_value": 0.003,
  "drift_detected": true,
  "n_reference": 1000,
  "n_current": 1000
}

drift_detected est true quand p_value < 0.05.

JavaScript

import { driftKs } from "seraplot";
const r = JSON.parse(driftKs(JSON.stringify({ reference, current })));