# Walidacja adwersarialna (czy test przypomina trening)

EN: **Adversarial validation** · id `adversarialvalidation` · aliases: adversarial validation, train-test discrimination

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Dane dla AI](https://aiatlasgraph.com/t/data.md) › [Podziały i wyciek danych](https://aiatlasgraph.com/t/splits.md) › Walidacja adwersarialna (czy test przypomina trening)

## Description

- PL: Klasyfikator odróżniający wiersze treningowe od testowych; jego AUC mierzy przesunięcie rozkładów, a ważność cech wskazuje przyczyny.
- EN: A classifier that separates training rows from test rows; its AUC measures distribution shift and its feature importances point to the causes.

## In one sentence

- PL: Sprawdzanie, czy dane testowe naprawdę przypominają treningowe, przez próbę nauczenia modelu odróżniania jednych od drugich.
- EN: Checking whether test data really resembles training data by trying to teach a model to tell them apart.

## Problem it solves

- PL: Model świetnie wypada w testach, a potem zawodzi na nowych danych, bo te wyglądają inaczej niż treningowe.
- EN: A model aces your tests, then fails on new data because that data looks different from the training set.

## What it does

- PL: Jeśli pomocniczy model łatwo zgadnie, z którego zbioru pochodzi wiersz, zbiory się różnią, a cechy, po których zgaduje, wskazują winowajców.
- EN: If a helper model easily guesses which set a row came from, the sets differ, and the features it relies on point to the culprits.

## Everyday example

- PL: Sklep internetowy odkrywa, że nowe zamówienia różnią się od zeszłorocznych porą zakupów, i przestaje opierać na niej prognozy.
- EN: An online shop finds that new orders differ from last year's in time of purchase and stops basing forecasts on it.

## This concerns you if you…

- PL: wynik modelu spada po wdrożeniu
- PL: porównujesz dane z różnych okresów lub źródeł
- EN: see a model's results drop after deployment
- EN: compare data from different periods or sources

## Keywords

covariate shift · train-test AUC · propensity score matching · inverse propensity weighting · feature drift · gradient boosting · Kaggle

## How it works

- PL: Wiersze treningowe i testowe łączy się z etykietą pochodzenia i trenuje klasyfikator, np. drzewa wzmacniane. AUC bliskie 0,5 oznacza podobne rozkłady. Przy wyższym AUC usuwa się cechy najsilniej zdradzające pochodzenie, wybiera walidację z przykładów najbardziej podobnych do testu albo przeważa trening.
- EN: Training and test rows are pooled with an origin label and a classifier such as gradient-boosted trees is trained. An AUC near 0.5 means similar distributions. With higher AUC, the most revealing features are dropped, validation rows most similar to the test set are chosen, or training rows are reweighted.

## Limits

- PL: Wykrywa tylko przesunięcie cech wejściowych, nie zmianę zależności między cechami a wynikiem. Usuwanie cech może wyciąć sygnał predykcyjny. Wymaga dostępu do (nieoznaczonych) danych docelowych.
- EN: It detects only shifts in input features, not changes in how features relate to the outcome. Dropping features can remove predictive signal. It needs access to (unlabelled) target data.

## Key terms

- PL: **AUC**: Miara, jak dobrze klasyfikator odróżnia dwie grupy; 0,5 to zgadywanie.
- PL: **przesunięcie kowariancji**: Zmiana rozkładu cech wejściowych między treningiem a użyciem.
- PL: **propensity score**: Prawdopodobieństwo, że wiersz pochodzi ze zbioru testowego.
- EN: **AUC**: How well a classifier separates two groups; 0.5 is guessing.
- EN: **covariate shift**: A change in input feature distribution between training and use.
- EN: **propensity score**: The probability that a row comes from the test set.

## Know first

- [Uczenie nadzorowane (Supervised learning)](https://aiatlasgraph.com/t/supervised.md)
- [Metryki klasyfikacji i regresji (Classification and regression metrics)](https://aiatlasgraph.com/t/classmetrics.md)

## Related topics

Untyped, symmetric "see also" links.

- [Strategie podziału: losowy, czasowy, grupowy (Split strategies: random, temporal, grouped)](https://aiatlasgraph.com/t/splitstrategies.md)

## Sources

- [Adversarial Validation Approach to Concept Drift Problem in User Targeting Automation Systems at Uber](<https://arxiv.org/abs/2004.03045>) `pan-adversarial-validation-2020` · by Jing Pan, Vincent Pham, Mohan Dorairaj, Huigang Chen, Jeong-Yoon Lee

---

AI Atlas revision 127 (2026-11-03) · HTML: https://aiatlasgraph.com/t/adversarialvalidation · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-11-03
