반응형

머신러닝,딥러닝/tensorflow 15

lec04 multi-variable linear regression tensorflow

recap hypothesis cost function gradient descent algorithm 3가지를 기억하고 있으면 지금까지 잘 배운 것 predictin gexam score regression using one input now we are going to regression using three inputs (x1, x2, x3) -> Y final score now we have several .. multi -varaible to calculate it we use matrix matrix multiplication hypothesis using matrix 우리가 원하는 값은 오른쪽이고 매트릭스 사용하면 왼쪽 처럼 간단하게 표현 가능 순서가 바뀌어도 같은 식이니까 오케이임 매트릭스..

lec 03 linear regrssion 의 cost 최소화

""" cost minimize하는 것이 목표 simplified hypotesis H(x) = wx cost W = 1/m E (w - y)^ 2 what cost(w) looks like? (1,1) (2,2) (3,3) if w = 1, cost = 0 = 1/3{(1-1)^2 + (2-2)^2 + (3-3)^2} if w = 0 cost = 4.67 = 1/3{(0-1)^2 + (0-2)^2 + (0-3)^2} if w = 2 cost = 4.67 y 축을 cost function x축은 w 라고 설정하고 그림을 그려봤더니 x^2 같이 생긴 이차함수로 나온다. w = 1 일 때 가장 작은 Cost 값을 가짐 이 그래프를 gradient descent algortihm 경사 내려가는 알고리즘 - m..

tensorflow lec 02 linear

""" predicting exam score : regression 학습 시킨다. 줄 x 는 자료 y 는 결과 간단하게 그래프로 그리면 이렇게 1,1 2,2 3,3 각각 점을 찍을 수 있다. linear hypothesis 세상한 많은 사례들이 이렇게 드러난다. 증가-> 증가 H(x) = Wx + b 선의 모양은 w, b의 값에 따라 달라지겠죠 어떤 선이 잘 맞는 선일까? 당연 이 경우에는 1,1 2,2 3,3을 지나는 선이 최고 Cost function : how fit the line to our (training) data 우리 가설과 실제 데이터가 얼마나 다른지 계산해주는 함수 가장 처음에는 H(x) - y 하지만 음수 양수 구별을 못한다. 다음으로 (h(x) - y ) ^ 2 이건 잘 표현할 ..

tensorflow 잘 안됨 Import tensorflow.compat.v1 as tf

여기 첫번째 댓글에 보면 텐서플로우 버전2에서 작동하시는 분들은 import tensorflow as tf 대신에 import tensorflow.compat.v1 as tf tf.disable_v2_behavior() 를 치고 하시면 잘 됩니다. 라고해서 구글 코랩에 import tensorflow.compat.v1 as tf tf.set_random_seed(777) # for reproducibilitywith tf.compat.v1.Session() as sess: x_train = [1,2,3] y_train = [1,2,3] W = tf.Variable(tf.random_normal([1]), name=‘weight’) b = tf.Variable(tf.random_normal([1]), na..

반응형