Learn R Programming

HVT (version 25.2.5)

plotAnimatedFlowmap: Generating flow maps and animations based on transition probabilities

Description

This is the main function for generating flow maps and animations based on transition probabilities including self states and excluding self states. Flow maps are a type of data visualization used to represent the transition probability of different states. Animations are the gifs used to represent the movement of data through the cells.

Usage

plotAnimatedFlowmap(
  hvt_model_output,
  transition_probability_df,
  df,
  flow_map = "All",
  cellid_column,
  time_column
)

Value

A list of flow maps and animation gifs.

Arguments

hvt_model_output

List. Output from a trainHVT function.

transition_probability_df

List. Output from getTransitionProbability function

df

Data frame. The input dataframe should contain two columns, cell ID from scoreHVT function and time stamp of that dataset.

flow_map

Character. Type of flow map ('self_state', 'without_self_state', 'All' or NULL)

cellid_column

Character. Name of the column containing cell IDs.

time_column

Character. Name of the column containing time stamps

Author

PonAnuReka Seenivasan <ponanureka.s@mu-sigma.com>, Vishwavani <vishwavani@mu-sigma.com>

See Also

trainHVT
scoreHVT
getTransitionProbability

Examples

Run this code
dataset <- data.frame(date = as.numeric(time(EuStockMarkets)),
                      DAX = EuStockMarkets[, "DAX"],
                      SMI = EuStockMarkets[, "SMI"],
                      CAC = EuStockMarkets[, "CAC"],
                      FTSE = EuStockMarkets[, "FTSE"])
hvt.results<- trainHVT(dataset,n_cells = 60, depth = 1, quant.err = 0.1,
                       distance_metric = "L1_Norm", error_metric = "max",
                       normalize = TRUE,quant_method = "kmeans")
scoring <- scoreHVT(dataset, hvt.results)
cell_id <- scoring$scoredPredictedData$Cell.ID
time_stamp <- dataset$date
dataset <- data.frame(cell_id, time_stamp)
table <- getTransitionProbability(dataset, cellid_column = "cell_id",
time_column = "time_stamp")
plots <- plotAnimatedFlowmap(hvt_model_output = hvt.results,
transition_probability_df = table,df = dataset,
flow_map = 'All',cellid_column = "cell_id", time_column = "time_stamp")

Run the code above in your browser using DataLab