define_clusters {evprof} | R Documentation |
Define each cluster with a user profile interpretation
Description
Every cluster has a centroid (i.e. average start time and duration) that can be related to a daily human behaviour or connection pattern (e.g. Worktime, Dinner, etc.). In this function, a user profile name is assigned to every cluster.
Usage
define_clusters(
models,
interpretations = NULL,
profile_names = NULL,
log = FALSE
)
Arguments
models |
tibble, parameters of the clusters' GMM models obtained with
function |
interpretations |
character vector with interpretation sentences of each cluster (arranged by cluster number) |
profile_names |
character vector with user profile assigned to each cluster (arranged by cluster number) |
log |
logical, whether to transform |
Value
tibble object
Examples
library(dplyr)
# Select working day sessions (`Timecycle == 1`) that
# disconnect the same day (`Disconnection == 1`)
sessions_day <- california_ev_sessions %>%
divide_by_timecycle(
months_cycles = list(1:12), # Not differentiation between months
wdays_cycles = list(1:5, 6:7) # Differentiation between workdays/weekends
) %>%
divide_by_disconnection(
division_hour = 10, start = 3
) %>%
filter(
Disconnection == 1, Timecycle == 1
) %>%
sample_frac(0.05)
plot_points(sessions_day, start = 3)
# Identify two clusters
sessions_clusters <- cluster_sessions(
sessions_day, k=2, seed = 1234, log = TRUE
)
# Plot the clusters found
plot_bivarGMM(
sessions = sessions_clusters$sessions,
models = sessions_clusters$models,
log = TRUE, start = 3
)
# Define the clusters with user profile interpretations
define_clusters(
models = sessions_clusters$models,
interpretations = c(
"Connections during working hours",
"Connections during all day (high variability)"
),
profile_names = c("Workers", "Visitors"),
log = TRUE
)
[Package evprof version 1.1.2 Index]