본문 바로가기

tensorflow7

05. Tensor Flow 로 Classification 예제 (binary) 05. Logistic Classification 출처 : 모두를위한 머신러닝 (http://hunkim.github.io/ml/) 이론 Logistic Regression¶ In [1]: import tensorflow as tf x_data = [[1, 2], [2, 3], [3, 1], [4, 3], [5, 3], [6, 2]] y_data = [[0], [0], [0], [1], [1], [1]] # placeholder for a tensor will be fed X = tf.placeholder(tf.float32, shape=[None, 2]) # n개 일때 None Y = tf.placeholder(tf.float32, shape=[None, 1]) # X: nx2, Y: nx1 --> X.. 2018. 8. 17.
04-2. Tensor Flow 에서 csv 파일 읽기 및 queue 사용법 04-2. Loading Data from File 출처 : 모두를위한 머신러닝 (http://hunkim.github.io/ml/) Data manipulate using Numpy¶List Slicing¶Numpy Indexing In [18]: import numpy as np import pandas as pd xy = np.loadtxt('static/data-01-test-score.csv', delimiter=',', dtype=np.float32) x_data = xy[:, 0:-1] y_data = xy[:, [-1]] print(x_data) print(y_data) [[ 73. 80. 75.] [ 93. 88. 93.] [ 89. 91. 90.] [ 96. 98. 100.] [ 73... 2018. 8. 17.
03. TensorFlow Linear Regression 의 cost 최소화 구현 03. Minimizing Cost Function in Linear Regression 출처 : 모두를위한 머신러닝 (http://hunkim.github.io/ml/) 이론 간소화 한 Hypothesis¶ W, cost(W) 스캔 해보기¶ In [9]: import tensorflow as tf import matplotlib.pyplot as plt X = [1, 2, 3] Y = [1, 2, 3] # W 는 계속 바뀌므로 place holder 로 W = tf.placeholder(tf.float32) hypothesis = X * W # H(x) = Wx cost = tf.reduce_mean(tf.square(hypothesis - Y)) # cost function sess = tf.Sess.. 2018. 8. 17.