Skip to content

Commit

Permalink
Merge pull request #24 from vzhomeexperiments/dev_0.4.1
Browse files Browse the repository at this point in the history
optimized code
  • Loading branch information
vzhomeexperiments authored Oct 15, 2020
2 parents 92e14af + fa40667 commit 4ff8291
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 14 deletions.
10 changes: 7 additions & 3 deletions R/aml_make_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)

###

Expand Down
4 changes: 3 additions & 1 deletion R/aml_score_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "/")
Expand Down
3 changes: 2 additions & 1 deletion R/aml_test_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "/")
Expand Down
10 changes: 7 additions & 3 deletions R/mt_make_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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]) {

Expand Down
3 changes: 3 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
15 changes: 13 additions & 2 deletions man/aml_make_model.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/aml_score_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/aml_test_model.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions man/mt_make_model.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4ff8291

Please sign in to comment.