글 수 223
텐서플로우 머신러닝 쿡북이라는 책에서 가우시안 커널로 비선형 구분을 하는 예제를 공부하는 중인데요. 커널 식이 다음과 같다고 합니다.
k(xi, xj) = e-y IIxi - xjII2
이것을 텐서플로우로
gamma = tf.constant(-50.0)
dist = tf.reduce_sum(tf.square(x_data),1)
dist = tf.reshape(dist, [-1,1])
sq_dists = tf.add(tf.subtract(dist, tf.multiply(2., tf.matmul(x_data, tf.transpose(x_data)))),
tf.transpose(dist))
my_kernel = tf.exp(tf.multiply(gamma, tf.abs(sq_dists)))
이렇게 쓰더군요. sq_dists에 절댓값을 씌운것이 IIxi - xjII2 인 것은 잘 알겠는데, 마지막 my_kernel과 위 공식이 어떻게 같은지 잘 이해가 가지 않습니다.
my_kernel은 egamma * IIxi - xjII^2 인거 같은데 제가 잘못 이해하고 있는 것인가요.
저는 SVM을 라이브러리로만 사용해봐서 커널 함수를 직접 구현하는건 잘 모르겠네요^^; 텐서플로 페이스북 그룹에 질문을 해보시는게 어떨까요?
https://www.facebook.com/groups/TensorFlowKR/