cluster_visits: Cluster Visits

Description Usage Arguments Value Examples

View source: R/clustering.R

Description

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

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
inter_term_vectors <- embed_terms(interviews, embedding_size = 10L,
                                  term_count_min = 1L)
exam_term_vectors <- embed_terms(examinations, embedding_size = 10L,
                                 term_count_min = 1L)
visits_vectors <- embed_list_visits(interviews,
                                    examinations, inter_term_vectors, exam_term_vectors)
clusters <- cluster_visits(visits_vectors, visits,
                           spec = "internist",
                           cluster_number = 2L)
clusters$size

sum(clusters$withinss)
clusters$centers

adamgdobrakowski/memr documentation built on Sept. 4, 2021, 3:45 a.m.