Files
2nd/10_Wiki/Topics/AI_and_ML/Feature Engineering.md
T
Antigravity Agent 0441f6e2a2 feat(wiki): implement P-Reinforce v3.0 standard & integrate 26+ new knowledge artifacts
- Formalized automatic record migration protocol in System Manual.
- Integrated high-density knowledge for RAG, AI, Business Strategy, and Leadership.
- Enhanced graph connectivity across core strategic hubs.
- Archived raw data and updated timeline records.
2026-05-04 22:40:32 +09:00

68 lines
3.7 KiB
Markdown

---
id: [[P-Reinforce|P-Reinforce]]-AUTO-FEG-001
category: AI_and_ML
confidence_score: 1.00
tags: [auto-reinforced, feature-engineering, feature-extraction, data-processing, ml-pipeline]
last_reinforced: 2026-05-04
---
# [[Feature Engineering|Feature Engineering]]
## 📌 한 줄 통찰 (The Karpathy Summary)
> "데이터의 재구성: 원본 데이터에서 머신러닝 알고리즘이 패턴을 더 잘 파합할 수 있도록 유용한 특징(Feature)을 선택, 변형, 생성하여 모델의 성능을 극대화하는 과정."
## 📖 구조화된 지식 (Synthesized Content)
특징 공학(Feature Engineering)은 원시 데이터(Raw Data)를 머신러닝 모델에 적합한 형태의 입력 변수로 변환하는 작업으로, 모델의 정확도에 결정적인 영향을 미칩니다.
1. **주요 프로세스**:
* **[[Feature Extraction|Feature Extraction (특징 추출)]]**: 고차원의 원본 데이터에서 가장 중요한 정보를 보존하면서 차원을 축소하거나 새로운 속성을 만들어냅니다. (예: 텍스트에서 [[Vector Embedding|임베딩]] 추출)
* **Feature Selection (특징 선택)**: 수많은 특징 중 모델 성능에 기여도가 높은 유의미한 변수만을 골라냅니다.
* **Feature Transformation (특징 변환)**: 데이터의 스케일을 조정하거나 분포를 정규화합니다.
2. **데이터 인코딩 기법**:
* **[[One-hot Encoding|One-hot Encoding (원-핫 인코딩)]]**: 범주형 데이터를 0과 1로 구성된 벡터로 변환합니다. 각 카테고리가 독립적일 때 유용하지만 차원이 급격히 늘어나는 단점이 있습니다.
* **Label Encoding**: 범주형 데이터를 단순 숫자로 변환합니다.
3. **검색 시스템에서의 활용**:
* 사용자 행동 데이터(클릭률, 체류 시간)를 특징으로 변환하여 [[Learning to Rank (LTR)|LTR]] 모델의 입력값으로 사용합니다.
## ⚖️ Trade-offs & Caveats
* **데이터 오염의 위험**: 오류가 있는 데이터 파이프라인에서 추출된 특징은 실제를 잘못 대변하며, 이는 모델 전체의 신뢰도를 무너뜨립니다.
* **차원의 저주**: 너무 많은 특징을 추가하면 연산 비용이 급증하고 모델이 복잡해져 성능이 저하될 수 있습니다. (단계적 확장이 권장됩니다.)
* **도메인 지식 의존성**: 효과적인 특징을 설계하기 위해서는 해당 데이터의 비즈니스적 맥락(도메인 지식)이 깊게 요구됩니다.
## 💻 실전 구현 코드 (Boilerplate)
`Pandas``Scikit-learn`을 활용한 기본적인 원-핫 인코딩 및 스케일링 예시입니다.
```python
import pandas as pd
from sklearn.preprocessing import OneHotEncoder, StandardScaler
# 1. 샘플 데이터 (범주형 '도시', 수치형 '인구')
df = pd.DataFrame({
'city': ['Seoul', 'Busan', 'Incheon', 'Seoul'],
'population': [9400, 3300, 2900, 9500]
})
# 2. 원-핫 인코딩 적용
encoder = OneHotEncoder(sparse_output=False)
city_encoded = encoder.fit_transform(df[['city']])
city_df = pd.DataFrame(city_encoded, columns=encoder.get_feature_names_out(['city']))
# 3. 수치 데이터 스케일링 (표준화)
scaler = StandardScaler()
df['pop_scaled'] = scaler.fit_transform(df[['population']])
# 4. 결합된 특징 데이터프레임
final_features = pd.concat([city_df, df['pop_scaled']], axis=1)
print(final_features)
```
## 🔗 지식 연결 (Graph)
* **관련 개념**: [[Machine Learning (Machine Learning)|Machine Learning]], [[Natural Language Processing (NLP)|NLP]]
* **기술적 도구**: [[One-hot Encoding|One-hot Encoding]], [[Vector Embedding|Vector Embedding]]
* **연결 알고리즘**: [[Learning to Rank (LTR)|Learning to Rank]]
---
*Last updated: 2026-05-04*