ts_svm: SVM

View source: R/ts_svm.R

ts_svmR Documentation

SVM

Description

Creates a time series prediction object that uses the Support Vector Machine (SVM). It wraps the e1071 library.

Usage

ts_svm(
  preprocess = NA,
  input_size = NA,
  kernel = "radial",
  epsilon = 0,
  cost = 10
)

Arguments

preprocess

normalization

input_size

input size for machine learning model

kernel

SVM kernel (linear, radial, polynomial, sigmoid)

epsilon

error threshold

cost

this parameter controls the trade-off between achieving a low error on the training data and minimizing the model complexity

Value

returns a ts_svm object.

Examples

data(sin_data)
ts <- ts_data(sin_data$y, 10)
ts_head(ts, 3)

samp <- ts_sample(ts, test_size = 5)
io_train <- ts_projection(samp$train)
io_test <- ts_projection(samp$test)

model <- ts_svm(ts_norm_gminmax(), input_size=4)
model <- fit(model, x=io_train$input, y=io_train$output)

prediction <- predict(model, x=io_test$input[1,], steps_ahead=5)
prediction <- as.vector(prediction)
output <- as.vector(io_test$output)

ev_test <- evaluate(model, output, prediction)
ev_test

daltoolbox documentation built on Nov. 3, 2024, 9:06 a.m.