ed-kyu
ee
ed-kyu
전체 방문자
오늘
어제
  • 분류 전체보기 (26)
    • 딥러닝, 머신러닝 (17)
      • NLP (0)
      • Vision (0)
      • 모두를 위한 딥러닝 강의 복습 (9)
      • Andrew Ng 강의 (0)
      • 캐글 (1)
      • 수학 (0)
      • DL Basic (5)
      • 논문 스터디 (2)
      • Product Serving (0)
    • TIL (1)
      • OS (0)
      • Network (0)
      • DB (0)
      • Docker (0)
      • Data Engineering (1)
    • 알고리즘 문제풀이 (3)
      • Baekjoon Algorithm (3)
      • Programmers (0)
    • 주제 없음 (5)
      • Python (2)
      • 기록 (1)
      • etc (2)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • 백준
  • 1012
  • 유기농 배추
  • Python
  • Kaggle
  • 티스토리챌린지
  • DeepLearningZeroToAll
  • ml
  • 오블완

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
ed-kyu

ee

Multi-variable linear regression
딥러닝, 머신러닝/모두를 위한 딥러닝 강의 복습

Multi-variable linear regression

2022. 1. 4. 21:15

모두를 위한 딥러닝 강의 시즌1을 듣고 복습한 내용입니다.

 

시험 점수 예측

 

Quiz 1 ( X1 ) Quiz 2 ( X2 ) Midterm 1 ( X3 ) Final ( Y )
73 80 75 152
93 88 93 185
89 91 90 180
96 98 100 196

Multi-variable cost function

 

앞선 식에서는 w값이 x값보다 앞에서 곱해졌지만 행렬 곱을 이용하기 위해서 X는 앞에, W는 뒤에 둔다.

 

 

 

[instance 수, var 수]  *  [ ? = var수 , ? = Y ]  =  [instance 수, Y]

- [n, 3] * [ ? = 3 , ? = 2 ] = [n, 2]

 

순서에 유의하기

 


텐서플로우 코드 (버전 2.0 이상)

import tensorflow as tf
import numpy as np

x_data = [[73., 80., 75.],
          [93., 88., 93.],
          [89., 91., 90.],
          [96., 98., 100.],
          [73., 66., 70.]]
y_data = [[152.],
          [185.],
          [180.],
          [196.],
          [142.]]

tf.model = tf.keras.Sequential()

tf.model.add(tf.keras.layers.Dense(units=1, input_dim=3))  # input_dim=3 gives multi-variable regression
tf.model.add(tf.keras.layers.Activation('linear'))  # this line can be omitted, as linear activation is default
# advanced reading https://towardsdatascience.com/activation-functions-neural-networks-1cbd9f8d91d6

tf.model.compile(loss='mse', optimizer=tf.keras.optimizers.SGD(lr=1e-5))
tf.model.summary()
history = tf.model.fit(x_data, y_data, epochs=100)

y_predict = tf.model.predict(np.array([[72., 93., 90.]]))
print(y_predict)

'딥러닝, 머신러닝 > 모두를 위한 딥러닝 강의 복습' 카테고리의 다른 글

Logistic Classification, Logistic Regression의 cost 함수  (0) 2022.01.05
TensorFlow로 파일에서 데이터 읽어오기  (0) 2022.01.04
Linear Regression의 cost 최소화 알고리즘의 원리  (0) 2022.01.04
Linear Regression  (0) 2022.01.04
기본적인 Machine Learning 의 용어와 개념 설명  (0) 2022.01.04
    '딥러닝, 머신러닝/모두를 위한 딥러닝 강의 복습' 카테고리의 다른 글
    • Logistic Classification, Logistic Regression의 cost 함수
    • TensorFlow로 파일에서 데이터 읽어오기
    • Linear Regression의 cost 최소화 알고리즘의 원리
    • Linear Regression
    ed-kyu
    ed-kyu

    티스토리툴바