knitr::opts_chunk$set( collapse = TRUE, warning = FALSE, comment = "#>" )
The goal of the STSMotif
R package is to allows the discovery and ranking of a motif in spatial-time series quickly and efficiently.
source(file = "../R/mainFunction.R") source(file = "../R/subFunction.R") source(file = "../R/visualization.R") library(stats) library(ggplot2) library(reshape2) library(RColorBrewer)
A pattern that significantly occurs in a time series is called a motif. In spatial time series data, these patterns may not be substantially present in a single time series but dispersed over several times series, limited in both space and time. The STMotif R package
was developed to simplify the Spatio-temporal data mining on the search for these motifs. We present the functions available in STMotif package
through the sample dataset, also available in this package.
First, install the package by typing:
install.packages("STMotif")
Then, load the package by typing:
library(STMotif)
It provides two categories of functions: for discovering and ranking motifs (CSAMiningProcess) and functions for viewing the identified motifs.
NormSAX
allows the normalization and SAX indexing of the dataset.# The process is launched on the provided example dataset dim(D <- STMotif::example_dataset) # Normalizartion and SAX indexing DS <- NormSAX(D = STMotif::example_dataset,a =5) # Information of the normalized and SAX indexing dataset # The candidates built head(NormSAX(D = STMotif::example_dataset, a = 5)[,1:10])
SearchSTMotifs
allows to check and filter the stmotifs, grouping the motifs from the neighboring block. # The list of motifs # stmotifs <- SearchSTMotifs(D,DS,w,a,sb,tb,si,ka) stmotifs <- SearchSTMotifs(D,DS,4,5,4,10,2,2) stmotifs[[1]]
RankSTMotifs
allows to rank the stmotifs list, making a balance between distance among the occurrences of a motif with the encoded information on the motif itself and his quantity. # The rank list of stmotifs rstmotifs <- RankSTMotifs(stmotifs) rstmotifs[[1]]
4.All this process can be summarized in the function CSAMiningProcess
which performs all the steps listed above.
# CSAMiningProcess stmotifs <- CSAMiningProcess(D,DS,4,5,4,10,2,2) rstmotifs[[1]]
display_motifsDataset(dataset = STMotif::example_dataset, rstmotifs[c(1:4)], 5)
display_motifsSTSeries(dataset = STMotif::example_dataset,rstmotifs[c(1:4)],space = c(1:4,10:12))
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.