diff --git a/R/aml_make_model.R b/R/aml_make_model.R index 08342a5..c0636e9 100644 --- a/R/aml_make_model.R +++ b/R/aml_make_model.R @@ -21,6 +21,8 @@ #' @param path_data Path where the aggregated historical data is stored, if exists in rds format #' @param force_update Boolean, by setting this to TRUE function will generate new model #' (useful after h2o engine update) +#' @param num_nn_options Integer, value from 1 to 20 or more. Used to change number of variants +#' of the random neural network structures #' #' @return Function is writing a file object with the best Deep Learning Regression model #' @export @@ -62,7 +64,8 @@ #' timeframe = 60, #' path_model = path_model, #' path_data = path_data, -#' force_update=FALSE) +#' force_update=FALSE, +#' num_nn_options = 2) #' #' # stop h2o engine #' h2o.shutdown(prompt = FALSE) @@ -75,7 +78,8 @@ #' #' aml_make_model <- function(symbol, timeframe, path_model, path_data, - force_update=FALSE){ + force_update=FALSE, + num_nn_options = 24){ requireNamespace("dplyr", quietly = TRUE) requireNamespace("readr", quietly = TRUE) @@ -129,7 +133,7 @@ aml_make_model <- function(symbol, timeframe, path_model, path_data, #h2o.init() ### random network structure - nn_sets <- sample.int(n = 100, 24) %>% matrix(ncol = 3) + nn_sets <- sample.int(n = 100, num_nn_options) %>% matrix(ncol = 3) ### diff --git a/R/aml_score_data.R b/R/aml_score_data.R index d027da9..50c424b 100644 --- a/R/aml_score_data.R +++ b/R/aml_score_data.R @@ -55,7 +55,9 @@ #' aml_make_model(symbol = 'USDJPY', #' timeframe = 60, #' path_model = path_model, -#' path_data = path_data) +#' path_data = path_data, +#' force_update=FALSE, +#' num_nn_options = 2) #' #' #' path_sbxm <- normalizePath(tempdir(),winslash = "/") diff --git a/R/aml_test_model.R b/R/aml_test_model.R index 8e3de6b..c2d6333 100644 --- a/R/aml_test_model.R +++ b/R/aml_test_model.R @@ -63,7 +63,8 @@ #' timeframe = 60, #' path_model = path_model, #' path_data = path_data, -#' force_update=FALSE) +#' force_update=FALSE, +#' num_nn_options = 2) #' #' path_sbxm <- normalizePath(tempdir(),winslash = "/") #' path_sbxs <- normalizePath(tempdir(),winslash = "/") diff --git a/R/mt_make_model.R b/R/mt_make_model.R index 775581a..b753512 100644 --- a/R/mt_make_model.R +++ b/R/mt_make_model.R @@ -25,6 +25,8 @@ #' @param path_model String, Path where the models are be stored #' @param path_data String, Path where the aggregated historical data is stored, if exists in rds format #' @param activate_balance Boolean, option to choose if to balance market type classes or not, default TRUE +#' @param num_nn_options Integer, value from 1 to 20 or more. Used to change number of variants +#' of the random neural network structures #' #' @return Function is writing file object with the model #' @export @@ -56,7 +58,8 @@ #' timeframe = 60, #' path_model = path_model, #' path_data = path_data, -#' activate_balance = TRUE) +#' activate_balance = TRUE, +#' num_nn_options = 2) #' #' # stop h2o engine #' h2o.shutdown(prompt = FALSE) @@ -72,7 +75,8 @@ mt_make_model <- function(indicator_dataset, num_bars, timeframe = 60, path_model, path_data, - activate_balance = TRUE){ + activate_balance = TRUE, + num_nn_options = 24){ requireNamespace("dplyr", quietly = TRUE) requireNamespace("readr", quietly = TRUE) @@ -111,7 +115,7 @@ mt_make_model <- function(indicator_dataset, # try different models and choose the best one... ### random network structure - nn_sets <- sample.int(n = 100, 24) %>% matrix(ncol = 3) + nn_sets <- sample.int(n = 100, num_nn_options) %>% matrix(ncol = 3) for (i in 1:dim(nn_sets)[1]) { diff --git a/cran-comments.md b/cran-comments.md index fe24dc2..4c4807e 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -12,5 +12,8 @@ There were no ERRORs or WARNINGs or NOTEs As of email from 07.10.2020 package was re-checked again +- removed tidyr from imports +- optimized code to allow faster and less CPU intensive calculations + ## Downstream dependencies R version 3.6.3 (2020-02-29) diff --git a/man/aml_make_model.Rd b/man/aml_make_model.Rd index 2b8ec7d..09285d7 100644 --- a/man/aml_make_model.Rd +++ b/man/aml_make_model.Rd @@ -4,7 +4,14 @@ \alias{aml_make_model} \title{Function to train Deep Learning regression model for a single asset} \usage{ -aml_make_model(symbol, timeframe, path_model, path_data, force_update = FALSE) +aml_make_model( + symbol, + timeframe, + path_model, + path_data, + force_update = FALSE, + num_nn_options = 24 +) } \arguments{ \item{symbol}{Character symbol of the asset for which to train the model} @@ -17,6 +24,9 @@ aml_make_model(symbol, timeframe, path_model, path_data, force_update = FALSE) \item{force_update}{Boolean, by setting this to TRUE function will generate new model (useful after h2o engine update)} + +\item{num_nn_options}{Integer, value from 1 to 20 or more. Used to change number of variants +of the random neural network structures} } \value{ Function is writing a file object with the best Deep Learning Regression model @@ -73,7 +83,8 @@ aml_make_model(symbol = 'USDJPY', timeframe = 60, path_model = path_model, path_data = path_data, - force_update=FALSE) + force_update=FALSE, + num_nn_options = 2) # stop h2o engine h2o.shutdown(prompt = FALSE) diff --git a/man/aml_score_data.Rd b/man/aml_score_data.Rd index 8b0e40b..23686de 100644 --- a/man/aml_score_data.Rd +++ b/man/aml_score_data.Rd @@ -66,7 +66,9 @@ h2o.init(nthreads = 2) aml_make_model(symbol = 'USDJPY', timeframe = 60, path_model = path_model, - path_data = path_data) + path_data = path_data, + force_update=FALSE, + num_nn_options = 2) path_sbxm <- normalizePath(tempdir(),winslash = "/") diff --git a/man/aml_test_model.Rd b/man/aml_test_model.Rd index fa40956..93ce80a 100644 --- a/man/aml_test_model.Rd +++ b/man/aml_test_model.Rd @@ -84,7 +84,8 @@ aml_make_model(symbol = 'USDJPY', timeframe = 60, path_model = path_model, path_data = path_data, - force_update=FALSE) + force_update=FALSE, + num_nn_options = 2) path_sbxm <- normalizePath(tempdir(),winslash = "/") path_sbxs <- normalizePath(tempdir(),winslash = "/") diff --git a/man/mt_make_model.Rd b/man/mt_make_model.Rd index 63d58ab..0a3b6d2 100644 --- a/man/mt_make_model.Rd +++ b/man/mt_make_model.Rd @@ -10,7 +10,8 @@ mt_make_model( timeframe = 60, path_model, path_data, - activate_balance = TRUE + activate_balance = TRUE, + num_nn_options = 24 ) } \arguments{ @@ -25,6 +26,9 @@ mt_make_model( \item{path_data}{String, Path where the aggregated historical data is stored, if exists in rds format} \item{activate_balance}{Boolean, option to choose if to balance market type classes or not, default TRUE} + +\item{num_nn_options}{Integer, value from 1 to 20 or more. Used to change number of variants +of the random neural network structures} } \value{ Function is writing file object with the model @@ -74,7 +78,8 @@ mt_make_model(indicator_dataset = macd_ML60M, timeframe = 60, path_model = path_model, path_data = path_data, - activate_balance = TRUE) + activate_balance = TRUE, + num_nn_options = 2) # stop h2o engine h2o.shutdown(prompt = FALSE)