зеркало из https://github.com/microsoft/wpa.git
feat: add L2 algorithm
This commit is contained in:
Родитель
e6a23c1d2b
Коммит
7b0a524785
|
@ -247,6 +247,7 @@ workpatterns_classify_bw <- function(data,
|
|||
|
||||
## Working patterns classification ---------------------------------------
|
||||
|
||||
# Level 1 with 7 personas
|
||||
personas_levels <-
|
||||
c("0 < 3 hours on",
|
||||
"1 Standard with breaks workday",
|
||||
|
@ -267,6 +268,32 @@ workpatterns_classify_bw <- function(data,
|
|||
ptn_data_personas[Active_Hours < 3, Personas := "0 < 3 hours on"]
|
||||
ptn_data_personas[, Personas := factor(Personas, levels = personas_levels)]
|
||||
|
||||
# Level 2 with 8 personas
|
||||
personas_levels_l2 <-
|
||||
c(
|
||||
"0 Low Activity (< 3 hours on)",
|
||||
"1.1 Standard continuous (expected schedule)",
|
||||
"1.2 Standard continuous (shifted schedule)",
|
||||
"2.1 Standard flexible (expected schedule)",
|
||||
"2.2 Standard flexible (shifted schedule)",
|
||||
"3 Long flexible workday",
|
||||
"4 Long continuous workday",
|
||||
"5 Always on (13h+)"
|
||||
)
|
||||
|
||||
ptn_data_personas[, Personas_L2 := "Unclassified"]
|
||||
ptn_data_personas[Active_Hours > exp_hours & Active_Hours==Day_Span , Personas_L2 := "4 Long continuous workday"]
|
||||
ptn_data_personas[Active_Hours > exp_hours & Active_Hours<Day_Span, Personas_L2 := "3 Long flexible workday"]
|
||||
ptn_data_personas[Active_Hours <= exp_hours & (Before_start>0|After_end>0), Personas_L2 := "2.2 Standard flexible (shifted schedule)"]
|
||||
ptn_data_personas[Active_Hours <= exp_hours & (Before_start == 0|After_end == 0), Personas_L2 := "2.1 Standard flexible (expected schedule)"]
|
||||
ptn_data_personas[Active_Hours == exp_hours & (Before_start>0|After_end>0), Personas_L2 := "1.2 Standard continuous (shifted schedule)"]
|
||||
ptn_data_personas[Active_Hours == exp_hours & (Before_start == 0|After_end == 0), Personas_L2 := "1.1 Standard continuous (expected schedule)"]
|
||||
ptn_data_personas[Active_Hours >= 13, Personas_L2 := "5 Always on (13h+)"]
|
||||
ptn_data_personas[Active_Hours < 3, Personas_L2 := "0 Low Activity (< 3 hours on)"]
|
||||
ptn_data_personas[, Personas_L2 := factor(Personas_L2, levels = personas_levels_l2)]
|
||||
|
||||
|
||||
|
||||
# bind cut tree to data frame
|
||||
ptn_data_final <-
|
||||
ptn_data_personas %>%
|
||||
|
|
Загрузка…
Ссылка в новой задаче