In [5]:
import tensorflow as tf
print(tf.__version__)
import numpy as np


1.2.0

아래는 학습 데이터 셋이다.


In [2]:
x_data = [[1, 2, 1], #행 하나당 하나의 데이터이다. 그리고 각열은 피쳐를 나타낸다.
          [1, 3, 2],
          [1, 3, 4],
          [1, 5, 5],
          [1, 7, 5],
          [1, 2, 5],
          [1, 6, 6],
          [1, 7, 7]]
#y_data는 one_hot으로 제공됨
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]]

아래의 테스트 데이터는 추후 테스트를 할때까지 사용하지 않는다.


In [3]:
x_test = [[2, 1, 1],
          [3, 1, 2],
          [3, 3, 4]]
y_test = [[0, 0, 1],
          [0, 0, 1],
          [0, 0, 1]]

In [4]:
X = tf.placeholder(dtype=tf.float32, shape=[None, 3]) #데이터의 개수는 정해져 있지 않다. 그러나 피처의 개수는 3으로 정해져 있다. 
Y = tf.placeholder(dtype=tf.float32, shape=[None, 3]) #y데이터도 개수는 정해져 있지 않다. 아마 x데이터의 개수와 동일할 것이다. 
                                                      #x데이터에 일대일로 매핑되기 때문이다. 그런데 열의개수는 원핫인코딩으로 표시해서
                                                      #3개 이다.

In [9]:
np.argmax(np.arange(10),axis=1)


---------------------------------------------------------------------------
AxisError                                 Traceback (most recent call last)
<ipython-input-9-9ca4b7935430> in <module>()
----> 1 np.argmax(np.arange(10),axis=1)

/Users/jaegyuhan/anaconda3/lib/python3.5/site-packages/numpy/core/fromnumeric.py in argmax(a, axis, out)
    961 
    962     """
--> 963     return _wrapfunc(a, 'argmax', axis=axis, out=out)
    964 
    965 

/Users/jaegyuhan/anaconda3/lib/python3.5/site-packages/numpy/core/fromnumeric.py in _wrapfunc(obj, method, *args, **kwds)
     55 def _wrapfunc(obj, method, *args, **kwds):
     56     try:
---> 57         return getattr(obj, method)(*args, **kwds)
     58 
     59     # An AttributeError occurs if the object does not have

AxisError: axis 1 is out of bounds for array of dimension 1

In [ ]: