# \donttest{
library(dplyr)
library(readr)
library(h2o)
library(lazytrade)
library(lubridate)
library(magrittr)
path_model <- normalizePath(tempdir(),winslash = "/")
path_data <- normalizePath(tempdir(),winslash = "/")
ind = system.file("extdata", "AI_RSIADXUSDJPY60.csv",
package = "lazytrade") %>% read_csv(col_names = FALSE)
ind$X1 <- ymd_hms(ind$X1)
tick = system.file("extdata", "TickSize_AI_RSIADX.csv",
package = "lazytrade") %>% read_csv(col_names = FALSE)
write_csv(tick, file.path(path_data, "TickSize_AI_RSIADX.csv"), col_names = FALSE)
# data transformation using the custom function for one symbol
aml_collect_data(indicator_dataset = ind,
symbol = 'USDJPY',
timeframe = 60,
path_data = path_data)
# dataset will be written to the temp directory
# start h2o engine
h2o.init(nthreads = 2)
# performing Deep Learning Regression using 2 random neural network structures and objective test
aml_make_model(symbol = 'USDJPY',
timeframe = 60,
path_model = path_model,
path_data = path_data,
force_update=FALSE,
objective_test = TRUE,
num_nn_options = 6,
num_epoch = 10,
min_perf = 0,
num_bars_test = 600,
num_bars_ahead = 34,
num_cols_used = 16)
# performing DL Regression using 2 random neural network structures
# with objective test, all columns
aml_make_model(symbol = 'USDJPY',
timeframe = 60,
path_model = path_model,
path_data = path_data,
force_update=FALSE,
objective_test = TRUE,
num_nn_options = 6,
num_epoch = 10,
min_perf = 0,
num_bars_test = 600,
num_bars_ahead = 34,
num_cols_used = 0)
# performing Deep Learning Regression using the custom function
aml_make_model(symbol = 'USDJPY',
timeframe = 60,
path_model = path_model,
path_data = path_data,
force_update=FALSE,
objective_test = FALSE,
num_nn_options = 6,
num_epoch = 10,
min_perf = 0,
num_bars_test = 600,
num_bars_ahead = 34,
num_cols_used = 16)
# performing Deep Learning Regression, fixed mode
aml_make_model(symbol = 'USDJPY',
timeframe = 60,
path_model = path_model,
path_data = path_data,
force_update=TRUE,
num_nn_options = 0,
fixed_nn_struct = c(100, 100),
num_epoch = 10,
min_perf = 0)
# stop h2o engine
h2o.shutdown(prompt = FALSE)
#set delay to insure h2o unit closes properly before the next test
Sys.sleep(5)
# }
Run the code above in your browser using DataLab