분류(2)
-
[텐서플로우/케라스] MNIST 숫자 분류하기 (softmax)
텐서플로우 데이터 불러오기 import tensorflow as tf import matplotlib.pyplot as plt import random tf.set_random_seed(777) from tensorflow.examples.tutorials.mnist import input_data mnist =input_data.read_data_sets("MNIST_data/", one_hot=True) 변수 정의 x = tf.placeholder(tf.float32, [None,784]) y = tf.placeholder(tf.float32, [None,10]) # 0~9 digit w = tf.Variable(tf.random_normal([784,10])) b = tf.Variable(tf.ra..
2020.04.21 -
[텐서플로우] 소프트맥스 회귀 (Softmax Regression) 분류 파이썬 코드
예제 데이터 x_data = [[1, 2, 1, 1], [2, 1, 3, 2], [3, 1, 3, 4], [4, 1, 5, 5], [1, 7, 5, 5], [1, 2, 5, 6], [1, 6, 6, 6], [1, 7, 7, 7]] y_data = [[0, 0, 1], #원핫인코딩 상태 [0, 0, 1], [0, 0, 1], [0, 1, 0], [0, 1, 0], [0, 1, 0], [1, 0, 0], [1, 0, 0]] 변수정의 x= tf.placeholder("float",shape=[None,4]) y= tf.placeholder("float",shape=[None,3]) #3: 분류기의 갯수 (분류 결과 종료의 가짓수) nb_classes = 3 w=tf.Variable(tf.random_norma..
2020.04.20