Skip to content

Instantly share code, notes, and snippets.

@InzamamRahaman
Created July 28, 2014 17:04
Show Gist options
  • Save InzamamRahaman/93477a1cecc762be6cdd to your computer and use it in GitHub Desktop.
Save InzamamRahaman/93477a1cecc762be6cdd to your computer and use it in GitHub Desktop.
prices <- data$Price
idx <- find_good_indicies(3, prices)
three <- prices[sapply(idx, function(x) {x - 3})]
two <- prices[sapply(idx, function(x) {x - 2})]
one <- prices[sapply(idx, function(x) {x - 1})]
actual <- prices[sapply(idx, function(x) {x - 0})]
develop_frame <- data.frame(list('Z3'=three, 'Z2'=two, 'Z1'=one,
'Zt'=actual))
samples <- length(develop_frame$Zt)
num_to_train <- ceiling(samples * 0.75)
num_to_test <- samples - num_to_train
trainer <- develop_frame[1 : num_to_train, ]
tester <- develop_frame[(num_to_train + 1) : num_to_test, ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment