> For the complete documentation index, see [llms.txt](https://www.nhasachso.io.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.nhasachso.io.vn/truc-tuyen/interactive-blocks-1/tac-gia/nguyen-hong-phuong/sach-cong-cu-ai-python/phan-2-hoc-may-machine-learning/catboost-mot-thu-vien-boosting-hieu-qua-do-yandex-phat-trien-tot-cho-du-lieu-chua-cac-dac-trung....md).

# CatBoost: Một thư viện boosting hiệu quả do Yandex phát triển, tốt cho dữ liệu chứa các đặc trưng...

#### **CatBoost**

**Mục tiêu:** Tối ưu hóa bài toán học máy với thuật toán **Gradient Boosting**, đặc biệt hiệu quả với dữ liệu chứa **các đặc trưng phân loại (categorical features)**.

**🧠 Đặc điểm nổi bật:**

* **Tự động xử lý dữ liệu phân loại** mà không cần mã hóa thủ công (không cần OneHot hay LabelEncoder).
* Giảm hiện tượng **overfitting** nhờ kỹ thuật **Ordered Boosting**.
* Cài đặt đơn giản, hỗ trợ GPU, tích hợp tốt với Pandas & Scikit-learn.

**📦 Ưu điểm:**

* Hiệu quả cao với dữ liệu dạng bảng chứa nhiều đặc trưng rời rạc.
* Dễ sử dụng, ít cần tinh chỉnh siêu tham số ban đầu.
* Hỗ trợ các bài toán phân loại, hồi quy, ranking và multi-class.

**Ví dụ sử dụng cơ bản:**

```python
from catboost import CatBoostClassifier
from sklearn.model_selection import train_test_split
import pandas as pd

# Dữ liệu mẫu với đặc trưng phân loại
df = pd.DataFrame({
    'age': [25, 35, 45, 22],
    'gender': ['M', 'F', 'M', 'F'],
    'target': [1, 0, 1, 0]
})

# Tách dữ liệu
X = df[['age', 'gender']]
y = df['target']
cat_features = ['gender']

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25)

# Mô hình CatBoost
model = CatBoostClassifier(verbose=0)
model.fit(X_train, y_train, cat_features=cat_features)

# Dự đoán
preds = model.predict(X_test)
```

***
