Title: | Quantum Walk-Based Data Analysis and Prediction |
---|---|
Description: | The modeling and prediction of graph-associated time series(GATS) based on continuous time quantum walk. This software is mainly used for feature extraction, modeling, prediction and result evaluation of GATS, including continuous time quantum walk simulation, feature selection, regression analysis, time series prediction, and series fit calculation. A paper is attached to the package for reference. |
Authors: | Binghuang Pan [aut, cre], Zhaoyuan Yu [aut], Xu Hu [ctb], Yuhao Teng [ctb] |
Maintainer: | Binghuang Pan <[email protected]> |
License: | GPL-2 |
Version: | 1.1.20 |
Built: | 2024-12-10 06:58:23 UTC |
Source: | CRAN |
calculate the Coefficient of Determination, Root Mean Squared Error and the Mean Absolute Error between two series.
qwdap.eval(series1, series2)
qwdap.eval(series1, series2)
series1 |
The series1. |
series2 |
The series2. |
Three indicators, the Coefficient of Determination, Root Mean Squared Error and Mean Absolute Error.
set.seed(1) res.eval <- qwdap.eval(rnorm(100,0,2),rnorm(100,0,1))
set.seed(1) res.eval <- qwdap.eval(rnorm(100,0,2),rnorm(100,0,1))
Principle component regression. This is a linear regression method used to establish the linear relationship between the original time series and the modes generated by quantum walks.
qwdap.pcr(in_data, data_range, plotting)
qwdap.pcr(in_data, data_range, plotting)
in_data |
a 'QWMS' object, which includes the target series and the selected modes which can be obtained from modes selection. |
data_range |
the range of the train samples. |
plotting |
whether to plot. |
a 'QWMODEL' object which includes the information of regression analysis.
data("traffic.n1") res.pcr <- qwdap.pcr(traffic.n1,c(1,500), FALSE)
data("traffic.n1") res.pcr <- qwdap.pcr(traffic.n1,c(1,500), FALSE)
Partial least squares regression. This is a linear regression method used to establish the linear relationship between the original time series and the modes generated by quantum walks.
qwdap.plsr(in_data, data_range, plotting)
qwdap.plsr(in_data, data_range, plotting)
in_data |
a 'QWMS' object, which includes the target series and the selected modes which can be obtained from modes selection. |
data_range |
the range of the train samples. |
plotting |
whether to plot. |
a 'QWMODEL' object which includes the information of regression analysis.
data("traffic.n1") res.plsr <- qwdap.plsr(traffic.n1,c(1,500),FALSE)
data("traffic.n1") res.plsr <- qwdap.plsr(traffic.n1,c(1,500),FALSE)
Projection pursuit regression. This is a nonlinear regression method used to establish the nonlinear relationship between the original time series and the modes generated by quantum walks.
qwdap.ppr(in_data, data_range, plotting)
qwdap.ppr(in_data, data_range, plotting)
in_data |
a 'QWMS' object, which includes the target series and the selected modes which can be obtained from modes selection. |
data_range |
the range of the train samples. |
plotting |
whether to plot. |
a 'QWMODEL' object which includes the information of regression analysis.
data("traffic.n1") res.ppr <- qwdap.ppr(traffic.n1,c(1,500))
data("traffic.n1") res.ppr <- qwdap.ppr(traffic.n1,c(1,500))
Based on the established model, make predict. The core algorithm of VAR prediction comes from MTS(ver. 1.1.1).
qwdap.predict(in_model, data_range)
qwdap.predict(in_model, data_range)
in_model |
a 'QWMODEL' object, which is the model built by Stepwise Regression, PCR, PLSR, PPR, VAR in this package. |
data_range |
indicate the index range of the part data generated by quantum walks for predict. |
the predict data.
data(traffic.model.n1) res.predict <- qwdap.predict(traffic.model.n1,c(501,720))
data(traffic.model.n1) res.predict <- qwdap.predict(traffic.model.n1,c(501,720))
Generate the modes, the probabilities that the walker being found at vertices. An adjacency matrix is need for the process.
qwdap.qwalk(edges, startindex, lens, scals, getfloat)
qwdap.qwalk(edges, startindex, lens, scals, getfloat)
edges |
your N*N adjacency matrix saved as list. |
startindex |
the initial position of the quantum walker. |
lens |
the number of records required in a round of sampling by a scaling factor. Set the length of the series according to requirements. |
scals |
the scaling factors used. |
getfloat |
Whether to return floating point data. |
'qwdap.qwalk()' is used to generated modes for time series analysis, the result is a object of class 'CTQW', the modes are saved in the object as a 3-dim array, and the parameters are also store in the object. The continuous time quantum walk is a continuous process, the modes are generated with a series of times, the parameter 'scals' can be understood as the tolerance of the arithmetic time series. Multiply tolerances can be passed in to obtain modes on different time scales through parameter 'scals'. The probability of the series with the probabilities that the walker being found at the vertices, and the length depends on parameter 'lens'. The data generated by this function is not recorded from the initial state. The shortest distance between all vertices and the initial position of the quantum walker is obtained by the Dijkstra algorithm.The probabilities corresponding to each vertex are recorded starting from the vertex furthest in the shortest distance is not 0. The function is single thread.
a object of class 'CTQW', the quantum walk results and some parameters.
Pan Binghuang
edges <- matrix(c(0,1,0,0,0,0,0, 1,0,1,0,0,0,0, 0,1,0,1,0,0,0, 0,0,1,0,1,0,0, 0,0,0,1,0,1,0, 0,0,0,0,1,0,1, 0,0,0,0,0,1,0), nrow = 7) res.qwalk <- qwdap.qwalk(edges,1,100,scals=seq(from=0.01, by=0.01, length.out=5))
edges <- matrix(c(0,1,0,0,0,0,0, 1,0,1,0,0,0,0, 0,1,0,1,0,0,0, 0,0,1,0,1,0,0, 0,0,0,1,0,1,0, 0,0,0,0,1,0,1, 0,0,0,0,0,1,0), nrow = 7) res.qwalk <- qwdap.qwalk(edges,1,100,scals=seq(from=0.01, by=0.01, length.out=5))
Mode selection by RReliefF. The purpose of this function is to select the part modes with similar characteristics to the observed time series from the modes generated by the quantum walk. And it is based on the data model.
qwdap.rrelieff(real, ctqw, index, num, plotting)
qwdap.rrelieff(real, ctqw, index, num, plotting)
real |
the real series observed. |
ctqw |
the 'CTQW' object. |
index |
the index of the data for mode selection. |
num |
the number of series required. |
plotting |
whether to plot. |
The 'QWMS' object include the original time series and the modes generated by quantum walks.
a 'QWMS' object.
data("traffic.qw") data("trafficflow") res.rrelieff <- qwdap.rrelieff(trafficflow,traffic.qw,1,30,TRUE)
data("traffic.qw") data("trafficflow") res.rrelieff <- qwdap.rrelieff(trafficflow,traffic.qw,1,30,TRUE)
Stepwise regression. This is a linear regression method used to establish the linear relationship between the original time series and the modes generated by quantum walks.
qwdap.swr(in_data, data_range, plotting)
qwdap.swr(in_data, data_range, plotting)
in_data |
a 'QWMS' object, which includes the target series and the selected modes which can be obtained from modes selection. |
data_range |
the range of the train samples. |
plotting |
whether to plot. |
a 'QWMODEL' object which includes the information of regression analysis.
data("traffic.n1") res.swr <- qwdap.swr(traffic.n1,c(1,500))
data("traffic.n1") res.swr <- qwdap.swr(traffic.n1,c(1,500))
Mode selection by Stepwise Regression. The purpose of this function is to select the part modes with similar characteristics to the observed time series from the modes generated by the quantum walk. And it is based on the linear model. The core algorithm comes from StepReg(ver. 1.4.2).
qwdap.sws(real, ctqw, index, select_method, plotting)
qwdap.sws(real, ctqw, index, select_method, plotting)
real |
the real series observed. |
ctqw |
the 'CTQW' object. |
index |
the index of the data for mode selection. |
select_method |
choose a stepwise method. |
plotting |
whether to plot. |
The 'QWMS' object include the original time series and the modes generated by quantum walks.
a 'QWMS' object.
data("traffic.qw") data("trafficflow") res.sws <- qwdap.sws(trafficflow,traffic.qw,1,"bidirection",TRUE)
data("traffic.qw") data("trafficflow") res.sws <- qwdap.sws(trafficflow,traffic.qw,1,"bidirection",TRUE)
Vector autoregressive model. This is a regression method used to establish the temporal relationship between the original time series and the modes generated by quantum walks. The core algorithm comes from MTS(ver. 1.1.1).
qwdap.var(in_data, data_range, plotting)
qwdap.var(in_data, data_range, plotting)
in_data |
a 'QWMS' object, which includes the target series and the selected modes which can be obtained from modes selection. |
data_range |
the range of the train samples. |
plotting |
whether to plot. |
a 'QWMODEL' object which includes the information of regression analysis.
data("traffic.n1") res.var <- qwdap.var(traffic.n1,c(1,500))
data("traffic.n1") res.var <- qwdap.var(traffic.n1,c(1,500))
This data is the linear model built by Stepwise Regression of the highway traffic flow data of the 'N1' stations, and includes the observed data and the modes generated by quantum walk.
data(traffic.model.n1)
data(traffic.model.n1)
A 'QWMODEL' object.
Pan BH(2021).
This data is the highway traffic flow data and the modes generated by quantum walk of the 'N1' stations.
data(traffic.n1)
data(traffic.n1)
A 'QWMS' object.
Pan BH(2021).
This data is generated by function 'qwdap.qwalk()' with 100 scaling factors form 0.01 to 1 and the parameter 'edges' is the adjancy matrix of 7 vertices connected end to end.
data(traffic.qw)
data(traffic.qw)
A 'CTQW' object.
Pan BH(2021).
This data set has a total of 720 records of 7 research stations, namely Tangshan (N1), Jurong (N2), Heyang (N3), Danyang (N4), Luoshuyan (N5), Xuejia (N6) and ChangzhouBei (N7).
data(trafficflow)
data(trafficflow)
A dataframe with 720 observations on the 7 stations.
Yu ZY, Hu X(2020).