🧐   classification 실습 

 

 

🧐   classification 실습 

 

 

🧐   tensorflow 실습 

🤔  tensorflow로 신경망 구조를 만드는 방법

1. sequence API를 사용하는 방법
 - Sequential()를 선언한 이후 model.add()함수를 입력하여 층을 쌓는다.


2. 함수형 API를 사용하는 방법
 - Sequential()로 tensorflow에 익숙해진 후 사용을 권장하는 방법

 

 

🤔  model 저장 _ save() 함수 

model.save('cnn_model_1.h5')

위와 같이 save메소드를 이용해 hdf5 파일로 저장한다.
(hdf5파일은 대용량 데이터 저장을 위한 파일 포맷이다.)

 

 

🤔  model 불러오기 

from tensorflow.keras.models import load_model
cnn_model_2 = load_model('cnn_model_1.h5')

위와 같이 save메소드를 이용해 hdf5 파일로 저장한다.
(hdf5파일은 대용량 데이터 저장을 위한 파일 포맷이다.)

 

 

 

 

 

 

 

 

🧐   batch size   /    epoch     /   iteration  의 차이  

🧐  batch size 
- 전체 training data를 여러개의 mini-batch로 나눴을 때, mini-batch에 속하는 data의 개수
- mini-batch로 나눠서 학습시간을 줄이고 효율적으로 자원을 활용할 수 있게 된다.
🧐  epoch 
- 전체 training data가 신경망을 통과한 횟수
- 1 epoch은 모든 data가 신경망을 한번 통과했다는 것을 의미
🧐  iteration 
- 1 epoch을 마치는데 필요한 mini-batch 수
- weight parameter는 mini-batch당 한번 update를 한다.
∴ 파라미터 update 횟수 = iteration 횟수

 

 

 

※ Supervised learning 과 Unsupervised learning

 Supervised learning (지도학습) _ Classification, Regression, etc.

정답과 오답 등과 같은 답이 있는 train dataset (학습데이터)로 학습시키는 것

 

§ 지도학습 알고리즘

  • 선형 회귀(linear regression)
  • 로지스틱 회귀(logistic regression)
  • k-최근접 이웃(k-NN : k-Nearest Neighbors)
  • 결정 트리(decision trees)
  • 신경망(neural networks), Deep NN
  • 서포트 벡터 머신(SVC : support vector machines)
  • 랜덤 포레스트(randome forests)

 

Unsupervised learning (비지도학습) _ Clustering, PCA, etc.

정답과 오답 등과 같은 답이 없는 train dataset (학습데이터)로 학습시키는 것

 

 

 

 

 

 

 

 

※ (Linear) Regression

장점: 사용하기 쉽고 설명력이 있다. (popular and easy to use, explain with prediction)

단점: 정확도와 linear 관계성을 설명해야 한다. (redundant features, irrelevant features)

 

Examples

▶ 목적:  how to predict y-values (continuous values)

 

 

 

§ β값은 어떻게 찾을 것인가?

1차 직선그래프에 대해 빨간 점과 그래프 사이의 y축과 평행한 거리가 error값이 된다.

 

 

[ β_hat 구하는 방법 증명 ]

 

 

 

 

 

 

 

※ Model evaluation (모델 평가) [ feat.   y,  y_hat ]

Correlation value: 상관계수

 

 

 

 

 

 

 

※ Regularization (규제화)

 

 

 

 

 

 

 

 

※ Nonlinear Regression

- input과 output사이의 관계성이 선형(nonlinear)일 때

 

 

 

 

※ Logistic Regression

 

※ Logistic Function

 

 

 

 

 

※ Logistic Regression 의 해석 방법

 

 

 

 

 

※ (Linear)Regression  vs  Logistic Regression

§ Regression

장점: 사용하기 쉽고 설명력이 있다. (popular and easy to use, explain with prediction)

단점: 정확도와 linear 관계성을 설명해야 한다. (redundant features, irrelevant features)

 

 

§ Logistic Regression

장점: 해석력이 괜찮고 사용하기 편하다. (Interpretability, Easy to use)

단점: 예측력(prediction)이 다른 모델에 비해 뛰어난 편에 속하지는 않는다. (Performance)

 

 

 

 

'A.I > Machine Learning_이론' 카테고리의 다른 글

[Machine Learning].Bayesian Classifier_이론  (0) 2022.11.04

+ Recent posts