본문 바로가기

AI/Deep Learning6

딥러닝: 04. Logistic Classification(로지스틱 회귀) 1.Logistic(regression) classification¶ Binary classification - True(1)/ False(0) 를 판단한다 logistic fnc)(시그모이드 함수) : H(X) = 1 / 1 + e^(-W^T*X) 시그모이드 함수를 사용했기 때문에 cost function 의 모양이 변한다. cost function for logistic¶ Minimize cost - Gradient decent algorithm¶ In [11]: import tensorflow as tf import numpy as np In [12]: xy = np.loadtxt('./dataset/pass.csv', delimiter=',', dtype=np.float32) In [13]: x .. 2019. 7. 30.
딥러닝: 03. 다중 선형 회귀(Multi Variable linear regression) In [6]: import numpy as np import tensorflow as tf In [14]: xy = np.loadtxt('./dataset/data-01-test-score.csv',delimiter=',' , dtype = np.float32 ) x = xy[:,0:-1] y = xy[:,[-1]] In [16]: print(x.shape, x, len(x)) print(y.shape, y, len(y)) (25, 3) [[ 73. 80. 75.] [ 93. 88. 93.] [ 89. 91. 90.] [ 96. 98. 100.] [ 73. 66. 70.] [ 53. 46. 55.] [ 69. 74. 77.] [ 47. 56. 60.] [ 87. 79. 90... 2019. 7. 30.
딥러닝: 02. 경사하강법(Gradient descent algorithm) Gradient descent algorithm¶ cost(W,b) fnc. 의 최소값을 찾는다. 어떤 점에서든 시작할 수 있다. 조금씩 W를 바꿔 최적의 cost(W,b)를 찾는다. In [29]: import tensorflow as tf import matplotlib.pyplot as plt In [30]: X = [1,2,3] Y = [1,2,3] W = tf.placeholder(tf.float32) hypothesis = X * W cost = tf.reduce_mean(tf.square(hypothesis - Y)) sess = tf.Session() sess.run(tf.global_variables_initializer()) W_val = [] cost_val = [] for i in .. 2019. 7. 30.
딥러닝 : 01. Tensorflow의 정의 1. Tensorflow 란?¶ tensorflow는 google에서 만든 딥러닝 프로그램을 쉽게 구현할 수 있는 라이브러리이다. 기본적인 언어를 지원하지만 python을 최우선으로 한다. 대부분의 편리한 기능들이 python library로만 구현되어 있다. tenor란 딥러닝에서 데이터를 표현하는 방식을 뜻하고 flow는 흐름을 뜻한다. tensor의 이해가 매우 중요하다. tensorflow의 연산은 dataflow graph로 이루어진다. 즉 텐서 형태의 데이터들이 딥러닝 모델을 구성하는 연산들의 그래프를 따라 흐르면서 연산한다고 보면 되겠다. tensorflow는 가장 인기있는 딥러닝 라이브러리이고 딥러닝을 사용하는데 더욱 편리하게 해준다. In [1]: import tensorflow as t.. 2019. 7. 26.
딥러닝 : 로지스틱 회귀 코딩 1.로지스틱 회귀의 정의¶참과 거짓 중 하나를 내놓는 과정. ex) 점수가 아닌 오직 합격과 불합격만 발표되는 시험의 경우 In [15]: import tensorflow as tf import numpy as np # 공부시간과 합격(0,1) 데이터 data = [[2,0], [4,0], [6,0], [8,1], [10,1], [12,1], [14,1]] x_data = [x_row[0] for x_row in data] y_data = [y_row[1] for y_row in data] In [16]: # a,b의 값을 임의로 정해준다. a = tf.Variable(tf.random_normal([1], dtype=tf.float64, seed = 0)) b = tf.Variable(tf.random.. 2019. 7. 25.
titanic : Machine Learning from Disaster - kaggle 연습 titanic : Machine Learning from Disaster - kaggle¶참조 https://www.kaggle.com/daehungwak/guide-kor-dg https://www.kaggle.com/ 데이터 분석 순서¶ 데이터 셋을 확인한다. 데이터가 어떻게 구성되어 있는지 확인 null data 확인후 향후 수정 탐색적 데이터 분석(EDA, Exploratory Data Analysis) 여러 feature 들을 개별적 분석, 상관관계 확인 여러 시각화 툴을 사용해 insight를 얻는다 특성 공학(Feature Engineering) 모델의 성능을 높일 수 있도록 feature 들을 engineering 합니다. one-hot encoding, class로 나누기, 구간으로 나누.. 2019. 7. 23.