Skip to content

Commit

Permalink
Merge pull request #5 from abhi18av/develop
Browse files Browse the repository at this point in the history
Pass the hyperparameters via nextflow
  • Loading branch information
abhi18av committed Nov 16, 2020
2 parents 4ab79e3 + 7ccde3f commit 7716fb8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
25 changes: 18 additions & 7 deletions modules/h2o/grid_naive_bayes/grid_naive_bayes.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
nextflow.enable.dsl = 2

params.nfolds = 5
params.seed = 1234
params.independent_variable = 'response'


// hyper-parameters
params.laplace= [0, 1, 2]
params.min_sdev= [0.3, 0.6, 0.9]
params.min_prob= [0.3, 0.6, 0.9]


process H2O_GRID_NAIVE_BAYES {
container "quay.io/abhi18av/nextflow_grid_search"
memory '4 GB'
Expand All @@ -26,26 +37,26 @@ test = h2o.import_file("${test_frame}")
# Identify predictors and response
x = train.columns
y = "response"
y = "${params.independent_variable}"
x.remove(y)
# For binary classification, response should be a factor
train[y] = train[y].asfactor()
test[y] = test[y].asfactor()
# Number of CV folds (to generate level-one data for stacking)
nfolds = 5
nfolds = ${params.nfolds}
nb_hyperparams = {
'laplace': [0, 1, 2],
'min_sdev': [0.3, 0.6, 0.9],
'min_prob': [0.3, 0.6, 0.9]
'laplace': ${params.laplace},
'min_sdev': ${params.min_sdev},
'min_prob': ${params.min_prob}
}
# Build and train the model:
nb_base_model = H2ONaiveBayesEstimator(
nfolds=5,
seed=1234)
nfolds=nfolds,
seed=${params.seed})
nb_grid = H2OGridSearch(model=nb_base_model,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
nextflow.enable.dsl = 2

include { H2O_GRID_NAIVE_BAYES } from "../../modules/h2o/grid_naive_bayes/grid_naive_bayes.nf"

params.H2O_GRID_NAIVE_BAYES = [
nfolds: 10
]
include { H2O_GRID_NAIVE_BAYES } from "../../modules/h2o/grid_naive_bayes/grid_naive_bayes.nf" addParams (params.H2O_GRID_NAIVE_BAYES)

include { UTILS_GRID_TOP_PERFORMER } from "../../modules/utils/grid_top_performer/grid_top_performer.nf"


Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 7716fb8

Please sign in to comment.