# Las losowy i bagging

EN: **Random forests and bagging** · id `randomforest`

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Uczenie maszynowe](https://aiatlasgraph.com/t/ml.md) › [Drzewa i metody zespołowe](https://aiatlasgraph.com/t/ensembles.md) › Las losowy i bagging

## Description

- PL: Wiele drzew trenowanych na losowych próbkach danych i cech, których głosy się uśrednia. Solidny model „z pudełka”, mało wrażliwy na ustawienia.
- EN: Many trees trained on random samples of rows and features, with their votes averaged. A robust out-of-the-box model that is not very sensitive to settings.

## In one sentence

- PL: To przewidywanie przez połączenie odpowiedzi wielu modeli zadających pytania o dane.
- EN: This predicts by combining answers from many models that ask questions about data.

## Problem it solves

- PL: Pojedynczy ciąg pytań może nadmiernie dopasować się do przypadkowych szczegółów danych i mylić się na nowych przypadkach.
- EN: A single question sequence can fit accidental data details too closely and make mistakes on new cases.

## What it does

- PL: Uczy modele na różnych losowych próbkach danych, przy pytaniach rozważa losowe zestawy cech, a potem uśrednia odpowiedzi lub głosy.
- EN: It trains models on different random data samples, considers random feature subsets for questions and then averages their answers or votes.

## Everyday example

- PL: System ocenia ryzyko zwrotu zamówienia, łącząc głosy wielu modeli wyuczonych na różnych próbkach wcześniejszych zakupów.
- EN: A system estimates an order's return risk by combining votes from models trained on different samples of past purchases.

## This concerns you if you…

- PL: pojedynczy model zbyt mocno reaguje na szczegóły danych
- PL: chcesz łączyć różne spojrzenia na tę samą tabelę
- EN: find that one model reacts too strongly to data details
- EN: want to combine different views of the same table

## Keywords

bootstrap aggregation · random feature subsets · out-of-bag error · permutation importance · ExtraTrees

## How it works

- PL: Drzewa trenuje się na losowanych próbach wierszy, ograniczając dostępne cechy przy wyborze podziałów. Uśrednianie wartości lub głosów zmniejsza wariancję, gdy modele nie popełniają identycznych błędów.
- EN: Trees train on resampled rows, restricting available features when selecting splits. Averaging values or votes reduces variance when models do not make identical errors.

## Limits

- PL: Losowanie nie usuwa wspólnego biasu ani przecieku danych. Duży las kosztuje pamięć i czas, a predykcje regresji słabo ekstrapolują poza obserwowany zakres.
- EN: Randomisation cannot remove shared bias or data leakage. Large forests cost memory and time, while regression predictions extrapolate poorly beyond observed ranges.

## Key terms

- PL: **bootstrap sample**: Próba utworzona przez losowanie wierszy z powtórzeniami.
- PL: **out-of-bag**: Ocena drzewa na wierszach niewylosowanych do jego treningu.
- EN: **bootstrap sample**: A dataset formed by sampling rows with replacement.
- EN: **out-of-bag**: Evaluating a tree on rows not sampled for its training.

## Know first

- [Drzewa decyzyjne (Decision trees)](https://aiatlasgraph.com/t/decisiontrees.md)
- [Statystyka i niepewność (Statistics and uncertainty)](https://aiatlasgraph.com/t/probability.md)

## Examples

- PL: bagging · ważność cech · błąd out-of-bag
- EN: bagging · feature importance · out-of-bag error

## Sources

- [scikit-learn User Guide (version 1.9.1)](<https://scikit-learn.org/stable/user_guide.html>) `sklearn-user-guide` · by scikit-learn developers
- [Why do tree-based models still outperform deep learning on tabular data?](<https://arxiv.org/abs/2207.08815>) `grinsztajn-tabular-2022` · by Léo Grinsztajn, Edouard Oyallon, Gaël Varoquaux

---

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