More actions
No edit summary |
No edit summary |
||
| Line 8: | Line 8: | ||
==== sklearn의 k-means ==== | ==== sklearn의 k-means ==== | ||
from sklearn import cluster | from sklearn import cluster | ||
clst = cluster.KMeans() | clst = cluster.KMeans() | ||
clst.fit([[0],[1],[2],[3], [1000], [1004], [1010], [2000], [100000], [12345], [23456], [66666]]) | clst.fit([[0],[1],[2],[3], [1000], [1004], [1010], [2000], [100000], [12345], [23456], [66666]]) | ||
clst.predict([[11], [3000], [99999]]) | clst.predict([[11], [3000], [99999]]) | ||
# result | # result | ||
# array([5, 6, 1], dtype=int32) | # array([5, 6, 1], dtype=int32) | ||
== 다음 시간에는 == | == 다음 시간에는 == | ||
Revision as of 17:13, 31 July 2016
내용
- sklearn의 k-means
- tensorflow로 k-means algorithm 구현하기
코드
sklearn의 k-means
from sklearn import cluster clst = cluster.KMeans() clst.fit([[0],[1],[2],[3], [1000], [1004], [1010], [2000], [100000], [12345], [23456], [66666]]) clst.predict([[11], [3000], [99999]]) # result # array([5, 6, 1], dtype=int32)