Last active
August 29, 2015 14:00
-
-
Save soonraah/2e78b9ca13295139cdb8 to your computer and use it in GitHub Desktop.
skmeans パッケージによるコサイン距離ベースの k-means 実行
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(slam) | |
library(skmeans) | |
# CSV からデータの読み込み | |
x <- read.csv("data.csv") | |
# skmeans で扱えるデータ構造(simple triplet matrix)に変換 | |
s <- as.simple_triplet_matrix(x) | |
# k-means 実行 | |
result <- skmeans(s, k=5) | |
# 結果の表示 | |
result$cluster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment