2. 지도 학습(Supervised learning): 회귀 분석(Regression), 파이썬 코드

2022. 2. 6. 20:49코딩/AI


* 지도 학습(Supervised learning)

- 지도 학습이란 Traing Data로 부터 특정한 함수를 유추해 내는 것. Classificaation, Regression의 예시가 있다.

- Classification : data label을 분류하고 예측하는 모델

- Regression : 연속형 변수들에 대해 변수들 사이의 관계를 분석하는 모델

 

 

 


* 비지도 학습(Unsupervised learning)

- 비지도 학습이란 Data가 어떻게 구성되었는지 알아내는 것. Clustering의 예시가 있다.

 

 

 

 


* Datasets: Traing data, Validation data, Test data

- Traing data : 학습을 시킬 때 사용하는 데이터 셋, Fit the parameters.

- Vaildation data : Hyperparameters을 수정하기 위해 사용하는 데이터 셋, 학습된 모델을 수정.

- Test data : 학습과 검증이 완료된 모델의 성능을 펴아하기 위한 datasets.

 

 

 


* 회귀 분석(Regression)

- Regression 문제의 예시

기상 조건 -> 예측 모델

자녀 수, 세금 납부 액수 -> 소비 트렌드 예측

R^d => R

Discrete { 0, 1, ... , k } => R

 

 

- Linear Regression : 선형 회귀 분석

data x_t 에서 y_t를 Linear function으로 추청하는 모델

 

 

- 모델 선택 방벙은? Least Squares

 

 

이 때, training data point 갯 수 N에 대해, x_i ~ R^d

X : N * (d + 1)

w : (d + 1) * 1

y : N * 1

 

Solution은

 

 

 

- Least square prediction

 

thin SVD 분해를 이용하면,

Solution은 

 

 

 

 

 


* 파이썬 코드

 

Linear Regression (Python Implementation) - GeeksforGeeks

A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

www.geeksforgeeks.org