experiments/example.r

library(vest)

# a small dataset for illustrative purposes
data(AirPassengers)

dataset <- my_embedd(AirPassengers, 10, h=1)
form <- target ~.
freq <- frequency(AirPassengers)


train <- head(dataset, -5)
test <- tail(dataset, 5)
testx <- test[,-grep("^target", colnames(test))]

train_feats <-
  feature_engineering(x = train,
                      targets = "target",
                      freq = freq)

train_dyns <- feat_select_corr(x = train_feats)
test_dyns <- predict(train_feats, testx)

trainf <- cbind.data.frame(train_dyns, train)
testf <- cbind.data.frame(test_dyns, test)

model <- LASSO.train(form, trainf)
preds <- LASSO.predict(model, testf)
vcerqueira/vest documentation built on Feb. 15, 2021, 6:57 p.m.