Cluster visits for given specialty of doctors, based on embeddings of visits. The clustering is performed by the k-means algorithm.

cluster_visits(visits_vectors, visit_table, spec, cluster_number = 5,
  nstart = 50, iter.max = 15)

Arguments

visits_vectors

A matrix of embeddings of visits

visit_table

A data frame with columns:

visit_id

specialties

Specialties of doctors, separated by ", "

spec

A specialty to be clustered

cluster_number

A number of desired clusters (default: 5)

nstart

Optionally, nstart argument of kmeans (default: 50)

inter.max

Optionally, inter.max argument of kmeans (default: 15)

Value

The result of k-means with: cluster, centers etc.

Examples

inter_term_vectors <- embed_terms(interviews, embedding_size = 10L, term_count_min = 1L)
#> Error in .subset2(public_bind_env, "initialize")(...): unused arguments (word_vectors_size = 10, vocabulary = list(c("fever", "rhinitis", "cough", "eye", "thyroid"), c(3, 3, 4, 4, 6), c(3, 3, 4, 4, 6)))
exam_term_vectors <- embed_terms(examinations, embedding_size = 10L, term_count_min = 1L)
#> Error in .subset2(public_bind_env, "initialize")(...): unused arguments (word_vectors_size = 10, vocabulary = list(c("fever", "man", "mother", "cough", "heart", "patient", "thyroid", "eye", "rhinitis", "woman", "father"), c(2, 2, 2, 3, 3, 3, 3, 4, 5, 6, 7), c(2, 2, 2, 3, 3, 3, 3, 4, 5, 6, 7)))
visits_vectors <- embed_list_visits(interviews, examinations, inter_term_vectors, exam_term_vectors)
#> Error in ncol(term_vectors): object 'inter_term_vectors' not found
clusters <- cluster_visits(visits_vectors, visits, spec = "internist", cluster_number = 2L)
#> Error in rownames(visits_vectors): object 'visits_vectors' not found
clusters$size
#> Error in eval(expr, envir, enclos): object 'clusters' not found
sum(clusters$withinss)
#> Error in eval(expr, envir, enclos): object 'clusters' not found
clusters$centers
#> Error in eval(expr, envir, enclos): object 'clusters' not found