Description Usage Arguments Examples
View source: R/clusteringTypicalDays.R
Run a clustering algorithm on the different classes of the calendar (getCalendar). Its principle is to create clusters by gathering the most similar days of each class and to choose among them the best representative: it will be a so-called typical day. The metric used to determine the similarity of two days is a weighted sum of 24 hourly distances, meaning the distances between the domains of the two days at the same hour.
1 2 3 | clusteringTypicalDays(calendar, vertices, nbClustWeek = 3,
nbClustWeekend = 1, report = TRUE, reportPath = getwd(),
hourWeight = rep(1, 24), maxDomainSize = 10000)
|
calendar |
|
vertices |
This parameter can be obtained with the function ptdfToVertices. |
nbClustWeek |
|
nbClustWeekend |
|
report |
|
reportPath |
|
hourWeight |
|
maxDomainSize |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(data.table)
# read vertices (from file, or obtained them with ptdfToVertices() function)
vertices <- fread(system.file("dataset/vertices_example.txt",package = "flowBasedClustering"))
# build calendar (manually here to adapt to the small dataset in example)
# (for pratical applications getCalendar() function might be more convenient)
calendar <- list()
calendar$interSeasonWe <- c("2016-09-17", "2016-09-18")
calendar$interSeasonWd <- c("2016-09-19", "2016-09-20", "2016-09-21", "2016-09-22", "2016-09-23")
calendar$winterWe <- c("2016-12-10", "2016-12-11")
calendar$winterWd <- c("2016-12-12", "2016-12-13", "2016-12-14", "2016-12-15", "2016-12-16")
calendar$summerWe <- c("2016-08-06", "2016-08-07")
calendar$summerWd <- c("2016-08-08", "2016-08-09", "2016-08-10", "2016-08-11", "2016-08-12")
# run clustering algorithm
clusterTD <- clusteringTypicalDays(calendar, vertices, nbClustWeek = 2, nbClustWeekend = 1)
# run clustering algorithm distinguishing the days only with the flow-based domains of hour 18
w <- rep(0,24)
w[18] <- 1
clusterTD <- clusteringTypicalDays(calendar, vertices, hourWeight = w, report = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.