Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- matplotlib
- 프로그래머스
- 실기
- seaborn
- level 2
- oracle
- level 1
- 오라클
- Python
- SQL
- 데이터 분석
- 알고리즘
- Kaggle
- 카카오
- 머신러닝
- pandas
- 빅데이터 분석 기사
- 파이썬
- 코딩테스트
- R
- 튜닝
- python3
- Oracel
- Numpy
- 실습
- 빅분기
- sklearn
Archives
- Today
- Total
라일락 꽃이 피는 날
[Sklearn] 파이프라인 (pipeline) 본문
728x90
파이프라인 (pipeline)
from sklearn.pipeline import make_pipeline
elasticnet_pipeline = make_pipeline(
StandardScaler(),
ElasticNet(alpha=0.1, l1_ratio=0.2)
)
elasticnet_pred = elasticnet_pipeline.fit(x_train, y_train).predict(x_test)
polynomial features
다항식의 계수간 상호작용을 통해 새로운 feature를 생성한다.
예를들면, [a, b] 2개의 feature가 존재한다고 가정하고,
degree=2로 설정한다면, polynomial features 는 [1, a, b, a^2, ab, b^2] 가 된다.
from sklearn.preprocessing import PolynomialFeatures
poly = PolynomialFeatures(degree=2, include_bias=False)
poly_features = poly.fit_transform(x_train)[0]
poly_pipeline = make_pipeline(
PolynomialFeatures(degree=2, include_bias=False),
StandardScaler(),
ElasticNet(alpha=0.1, l1_ratio=0.2)
)
poly_pred = poly_pipeline.fit(x_train, y_train).predict(x_test)
728x90
'데이터 분석 > Python' 카테고리의 다른 글
[Sklearn] 앙상블 (Ensemble) - 부스팅 (Boosting) (0) | 2021.05.17 |
---|---|
[Sklearn] 앙상블 (Ensemble) - 보팅 (Voting), 배깅 (Bagging) (0) | 2021.05.17 |
[Sklearn] Scaler (0) | 2021.05.14 |
[Sklearn] ElasticNet (0) | 2021.05.13 |
[Sklearn] 규제 (Regularization) (0) | 2021.05.13 |