R/AlgoTSIMD.R

Defines functions AlgoTSIMD

AlgoTSIMD <- function(X, y, n_slices = 10, dimension_threshold = 0.8, n_dimensions = 5, n_lags = 12){
  # For Laggers, lets return all the values.
  # Then we can implement a 0.8/number of dimensions hyperparameter.
  # Brings package together.
  # Checks data, stops if there is an error.
  PreProcessTSIMD(X = X, y = y)
  
  # Standardises the X values.
  X_stand <- StandardTSIMD(X) # Add in errors if NA's here.
  
  # Gets the discretized y values with respect to the number of slices.
  y_disc <- DiscretizeTSIMD(y, n_slices)
  
  # Computing left vs right means, and computing the V.hat_LVR matrix
  out_matrix <- LVRMeansTSIMD(X_stand, y_disc, 10)
  
  # Compute an eigenvalue decomposition and keep the index.
  idx <- rank(-abs(colMeans(out_matrix)))
  eigen_values <- eigen(out_matrix)$values[idx]
  
  # These eigens should be in the same order as the columns they correspond
  return(eigen_values)
}
hectorhaffenden/TSIMD documentation built on Nov. 4, 2019, 1:30 p.m.