일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 카카오
- seaborn
- Oracel
- R
- 파이썬
- sklearn
- 오라클
- python3
- 프로그래머스
- 튜닝
- Python
- pandas
- Kaggle
- level 2
- 실기
- 알고리즘
- oracle
- level 1
- 코딩테스트
- 머신러닝
- matplotlib
- 데이터 분석
- SQL
- 실습
- 빅분기
- 빅데이터 분석 기사
- Numpy
- Today
- Total
라일락 꽃이 피는 날
[Sklearn] Training Set, Test Set 본문
scikit-learn
https://scikit-learn.org/stable/
scikit-learn: machine learning in Python — scikit-learn 0.24.2 documentation
Model selection Comparing, validating and choosing parameters and models. Applications: Improved accuracy via parameter tuning Algorithms: grid search, cross validation, metrics, and more...
scikit-learn.org
from sklearn.linear_model import LinearRegression
모델 선언: model = LinearRegression()
학습: model.fit(x, y)
예측: prediction = model.predict(x2)
x
features 라고 불린다.
x_train, x_test
학습을 위한 데이터 세트이므로 예측할 값은 빠져있다.
예) 지역, 평형 정보, 층수 정보, 동네, 거주민 평균 나이 등
y
labels 라고 불린다.
y_train, y_test
예측해야 할 값이므로 예측값만 존재한다.
예) 집값
학습을 위한 데이터 (Training Set)
Training Set 80% + Validation Set 20%
모델이 학습하기 위해 필요한 데이터 + 검증을 위한 데이터
학습할 때 검증을 위한 데이터가 관여되면 안 된다.
feature/label 모두 존재 (x_train, y_train)
예측을 위한 데이터 (Test Set)
모델이 예측하기 위한 데이터
feature만 존재 (x_test)
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(x_train, y_train)
prediction = model.predict(x_test)
'데이터 분석 > Python' 카테고리의 다른 글
[Sklearn] 데이터 셋 (dataset) (0) | 2021.05.13 |
---|---|
[Sklearn] 전처리 (pre-processing) (0) | 2021.05.11 |
인공지능, 머신러닝, 딥러닝 (0) | 2021.05.11 |
[Seaborn] 그래프 그리기 2 (0) | 2021.05.11 |
[Seaborn] 그래프 그리기 1 (0) | 2021.05.11 |