Skip to content

Commit

Permalink
Added params to the master script
Browse files Browse the repository at this point in the history
  • Loading branch information
Wit Jakuczun committed Sep 23, 2017
1 parent 686eeab commit 5548654
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ You should get the following output
Run model training and evaluation

```bash
Rscript R\build_telco_churn_model.R
Rscript.exe R\build_telco_churn_model.R --nthreads=4 --max-mem="4g"
```

Please note that script has two parameters:

* *nthreads* - number of threads to be used with -1 (all) as default
* *max_mem* - maximum memory size for H2O with 4g as default

### Check results

Expand Down
9 changes: 7 additions & 2 deletions telco-customer-churn-in-r-and-h2o/R/build_telco_churn_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ all_data[, churn := factor(ifelse(churn == 1, "churn", "nochurn"))]

loginfo("--> done")

h2o_local <- h2o.init(nthreads = 4,
max_mem_size = "6g")
nthreads <- as.integer(args$get("nthreads", required = FALSE, default = -1))
max_mem_size <- args$get("max_mem", required = FALSE, default = "4g")

logdebug("------> nthreads:%d, max_mem_size:%s", nthreads, max_mem_size)

h2o_local <- h2o.init(nthreads = nthreads,
max_mem_size = max_mem_size)
h2o.removeAll()

h2o_train <- as.h2o(x = all_data[ind == "Train"],
Expand Down

0 comments on commit 5548654

Please sign in to comment.