我正在尝试对多元时间序列数据进行分类,并且我使用了 SVM、神经网络、基于 DTW 的 KNN 等机器学习算法。现在我将使用自动回归等统计模型对我的数据进行分类,以便这样做我已经在 R 中编写了一些代码,但似乎无法进行分类,因为结果是一些浮点数,而不是分类数。你有这种情况的经验吗?这是我的代码:
## status is the label of my data which is 0: Not exercising 1:
#exercising
library(vars)
dt=read.csv('data.csv')
# plot.ts(diff(dt$gx))
# plot.ts(dt$my)
# Box.test(dt$yaw,lag = 20,type = 'Ljung-Box')
attach(dt)
var=cbind(ax,ay,az,status)
#VARselect(var, lag.max = 10, type = "both")
model=VAR(var,type = 'const',lag.max = 10,ic = 'AIC',p = 4)
arch.test(model, lags.multi = 10)
# grangertest(status ~ ax, order = 4)
prd=predict(model, n.ahead = 10, ci = 0.95, dumvar = NULL)
状态结果:
$状态
fcst lower upper CI
[1,] 0.002911329 -0.1104069 0.1162295 0.1133182
[2,] 0.005366295 -0.1551971 0.1659297 0.1605634
[3,] 0.008643568 -0.1880706 0.2053577 0.1967141
[4,] 0.009482430 -0.2172989 0.2362637 0.2267813
[5,] 0.012580248 -0.2405501 0.2657106 0.2531303
[6,] 0.014794586 -0.2618808 0.2914700 0.2766754
[7,] 0.015800219 -0.2825497 0.3141501 0.2983499
[8,] 0.015899414 -0.3023957 0.3341945 0.3182951
[9,] 0.016415702 -0.3200783 0.3529097 0.3364940
[10,] 0.017935262 -0.3354627 0.3713333 0.3533980
但是,我预计它是 0 或 1。