Title: | Convolution-Based Linear Discriminant Analysis |
---|---|
Description: | Contains a time series classification method that obtains a set of filters that maximize the between-class and minimize the within-class distances. |
Authors: | Grover E. Castro Guzman [cre, aut], André Fujita [aut] |
Maintainer: | Grover E. Castro Guzman <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1 |
Built: | 2024-11-20 06:39:51 UTC |
Source: | CRAN |
Classify the time series and obtain the distances between the time series and the centroids of each class.
clda.classify(model, Data)
clda.classify(model, Data)
model |
An object returned by the function |
Data |
Matrix of time series on the rows. |
A list containing the predicted labels of the time series
and a matrix of distances between the time series and the centroids after applying
the filters obtained by clda.model
.
Grover E. Castro Guzman
André Fujita
## Generating 200 time series of length 100 with label 1 time_series_signal_1 = sin(matrix(runif(200*100),nrow = 200,ncol = 100)) time_series_error_1 = matrix(rnorm(200*100),nrow = 200,ncol = 100) time_series_w_label_1 = time_series_signal_1 + time_series_error_1 ## Generating another 200 time series of length 100 with label 2 time_series_signal_2 = cos(matrix(runif(200*100),nrow = 200,ncol = 100)) time_series_error_2 = matrix(rnorm(200*100),nrow = 200,ncol = 100) time_series_w_label_2 = time_series_signal_2 + time_series_error_2 ## Join the time series data in one matrix time_series_data = rbind(time_series_w_label_1,time_series_w_label_2) label_time_series = c(rep(1,200),rep(2,200)) clda_model <- clda.model(time_series_data,label_time_series) ## Create a test set ## data with label 1 Data_test_label_1 = sin(matrix(runif(50*100),nrow = 50,ncol = 100)) ## data with label 2 Data_test_label_2 = cos(matrix(runif(50*100),nrow = 50,ncol = 100)) ## join data into a single matrix Data_test = rbind(Data_test_label_1,Data_test_label_2) ## obtain the labels and distances of each time series clda.classify(clda_model,Data_test)
## Generating 200 time series of length 100 with label 1 time_series_signal_1 = sin(matrix(runif(200*100),nrow = 200,ncol = 100)) time_series_error_1 = matrix(rnorm(200*100),nrow = 200,ncol = 100) time_series_w_label_1 = time_series_signal_1 + time_series_error_1 ## Generating another 200 time series of length 100 with label 2 time_series_signal_2 = cos(matrix(runif(200*100),nrow = 200,ncol = 100)) time_series_error_2 = matrix(rnorm(200*100),nrow = 200,ncol = 100) time_series_w_label_2 = time_series_signal_2 + time_series_error_2 ## Join the time series data in one matrix time_series_data = rbind(time_series_w_label_1,time_series_w_label_2) label_time_series = c(rep(1,200),rep(2,200)) clda_model <- clda.model(time_series_data,label_time_series) ## Create a test set ## data with label 1 Data_test_label_1 = sin(matrix(runif(50*100),nrow = 50,ncol = 100)) ## data with label 2 Data_test_label_2 = cos(matrix(runif(50*100),nrow = 50,ncol = 100)) ## join data into a single matrix Data_test = rbind(Data_test_label_1,Data_test_label_2) ## obtain the labels and distances of each time series clda.classify(clda_model,Data_test)
Obtains a set of filters for labeled time series data so that the between-class distances are maximized, and the within-class distances are minimized.
clda.model(Data, Labels)
clda.model(Data, Labels)
Data |
Matrix of time series on the rows. |
Labels |
Label of each time series. |
A list containing the filters and their respective importance (g and eig_val), the class means (Means), the average of the class means (Mean), and the labels of each class mean (classes). The filters are the columns of the matrix g.
Grover E. Castro Guzman
André Fujita
## Generating 200 time series of length 100 with label 1 time_series_signal_1 = sin(matrix(runif(200*100),nrow = 200,ncol = 100)) time_series_error_1 = matrix(rnorm(200*100),nrow = 200,ncol = 100) time_series_w_label_1 = time_series_signal_1 + time_series_error_1 ## Generating another 200 time series of length 100 with label 2 time_series_signal_2 = cos(matrix(runif(200*100),nrow = 200,ncol = 100)) time_series_error_2 = matrix(rnorm(200*100),nrow = 200,ncol = 100) time_series_w_label_2 = time_series_signal_2 + time_series_error_2 ## Join the time series data in one matrix time_series_data = rbind(time_series_w_label_1,time_series_w_label_2) label_time_series = c(rep(1,200),rep(2,200)) ## obtain the model with the given data clda.model(time_series_data,label_time_series)
## Generating 200 time series of length 100 with label 1 time_series_signal_1 = sin(matrix(runif(200*100),nrow = 200,ncol = 100)) time_series_error_1 = matrix(rnorm(200*100),nrow = 200,ncol = 100) time_series_w_label_1 = time_series_signal_1 + time_series_error_1 ## Generating another 200 time series of length 100 with label 2 time_series_signal_2 = cos(matrix(runif(200*100),nrow = 200,ncol = 100)) time_series_error_2 = matrix(rnorm(200*100),nrow = 200,ncol = 100) time_series_w_label_2 = time_series_signal_2 + time_series_error_2 ## Join the time series data in one matrix time_series_data = rbind(time_series_w_label_1,time_series_w_label_2) label_time_series = c(rep(1,200),rep(2,200)) ## obtain the model with the given data clda.model(time_series_data,label_time_series)