Im trying to Cluster a matrix of words by their semantic correlation with the OPTICS algorithm.
I have a matrix like this:
I want to see each row as a vector (~260 dimensions) and cluster the terms that are closest to each other.
My code so far:
require("dbscan")
require("readxl")
list <- read_excel(choose.files())
list_only_colnames <- read_excel(choose.files())[1]
Matrix<- matrix(unlist(as.double(list$Column2)),266,266,TRUE)
list_only_colnames <- unlist(list_only_colnames)
colnames(Matrix) <- list_only_colnames
rownames(Matrix) <- list_only_colnames
### run OPTICS
res <- optics(Matrix, eps = 10, minPts = 0,4)
res
Questions
- How do I show the rownames when it comes to clustering?
- How do I set the number of clusters in the first place?