# Selekcja cech

EN: **Feature selection** · id `featureselection` · aliases: wybór cech, variable selection

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Uczenie maszynowe](https://aiatlasgraph.com/t/ml.md) › [Przygotowanie cech (feature engineering)](https://aiatlasgraph.com/t/featureeng.md) › Selekcja cech

## Description

- PL: Wybór podzbioru cech metodami filtrującymi (testy, informacja wzajemna), opakowującymi (RFE, selekcja sekwencyjna) i wbudowanymi (L1, ważność cech).
- EN: Choosing a feature subset with filter methods (tests, mutual information), wrapper methods (RFE, sequential selection) and embedded methods (L1, feature importance).

## In one sentence

- PL: Wybieranie z wielu kolumn tylko tych, które naprawdę pomagają w przewidywaniu.
- EN: Picking, from many columns, only those that actually help predictions.

## Problem it solves

- PL: Setki kolumn spowalniają model, zaciemniają wyniki i zwiększają ryzyko nauczenia się przypadkowych zbieżności.
- EN: Hundreds of columns slow a model down, muddy its results and raise the risk of learning coincidences.

## What it does

- PL: Jak pakowanie walizki: sprawdzasz każdą rzecz i zostawiasz tylko to, czego w podróży naprawdę użyjesz.
- EN: Like packing a suitcase: you check each item and keep only what you'll actually use on the trip.

## Everyday example

- PL: Z dwustu pomiarów czujników maszyny zostawiasz piętnaście, które najlepiej zapowiadają awarię.
- EN: Out of two hundred machine sensor readings, you keep the fifteen that best signal an upcoming failure.

## This concerns you if you…

- PL: masz więcej kolumn, niż jesteś w stanie zrozumieć
- PL: chcesz prostszego i tańszego modelu
- EN: have more columns than you can make sense of
- EN: want a simpler, cheaper model

## Keywords

SelectKBest · mutual information · RFE · RFECV · SelectFromModel · SequentialFeatureSelector · Lasso · VarianceThreshold · Boruta

## How it works

- PL: Filtry oceniają każdą cechę niezależnie od modelu, np. testem chi-kwadrat lub informacją wzajemną z celem. Metody opakowujące trenują model na różnych podzbiorach i usuwają albo dodają cechy według wyniku walidacji krzyżowej. Metody wbudowane wybierają cechy w trakcie treningu, np. regularyzacją L1.
- EN: Filters score each feature independently of the model, e.g. with a chi-squared test or mutual information with the target. Wrapper methods train the model on different subsets, removing or adding features by cross-validated score. Embedded methods select during training, e.g. through L1 regularisation.

## Limits

- PL: Selekcja wykonana przed podziałem danych przecieka informacją i zawyża wyniki. Metody opakowujące są kosztowne. Cechy skorelowane mogą się wzajemnie maskować, więc wybrany zbiór bywa niestabilny.
- EN: Selecting before splitting the data leaks information and inflates scores. Wrapper methods are expensive. Correlated features can mask each other, making the chosen set unstable.

## Key terms

- PL: **informacja wzajemna**: Miara tego, ile wiedza o cesze mówi o wyniku.
- PL: **RFE**: Rekurencyjne usuwanie najsłabszych cech i ponowne trenowanie modelu.
- PL: **regularyzacja L1**: Kara za wagi, która zeruje wagi zbędnych cech.
- EN: **mutual information**: How much knowing a feature tells you about the outcome.
- EN: **RFE**: Recursively removing the weakest features and retraining the model.
- EN: **L1 regularisation**: A weight penalty that drives useless features' weights to zero.

## Know first

- [Walidacja krzyżowa (Cross-validation)](https://aiatlasgraph.com/t/crossval.md)

## Sources

- [scikit-learn — sklearn.feature_selection module (API index)](<https://scikit-learn.org/stable/api/sklearn.feature_selection.html>) `sklearn-featureselection-api` · by scikit-learn developers
- [scikit-learn — Common pitfalls and recommended practices](<https://scikit-learn.org/stable/common_pitfalls.html>) `sklearn-pitfalls` · by scikit-learn developers

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/featureselection · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
