Learn R Programming

HVT (version 25.2.4)

getTransitionProbability: Creating Transition Probability Matrix

Description

This is the main function to create transition probability matrix The transition probability matrix quantifies the likelihood of transitioning from one state to another. States: The table includes the current states and the possible next states. Probabilities: For each current state, it lists the probability of transitioning to each of the next possible states.

Usage

getTransitionProbability(
  df,
  cellid_column,
  time_column,
  type = "with_self_state"
)

Value

Stores a data frames with transition probabilities.

Arguments

df

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

cellid_column

Character. Name of the column containing cell IDs.

time_column

Character. Name of the column containing time stamps.

type

Character. A character value indicating the type of transition probability table to create. Accepted entries are "with_self_state" and "without_self_state".

Author

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

Examples

Run this code
dataset <- data.frame(t = as.numeric(time(EuStockMarkets)),
                      DAX = EuStockMarkets[, "DAX"],
                      SMI = EuStockMarkets[, "SMI"],
                      CAC = EuStockMarkets[, "CAC"],
                      FTSE = EuStockMarkets[, "FTSE"])
hvt.results<- trainHVT(dataset[-1],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$t
dataset <- data.frame(cell_id, time_stamp)
table <- getTransitionProbability(dataset, cellid_column = "cell_id",time_column = "time_stamp")

Run the code above in your browser using DataLab