Skip to content

Commit

Permalink
Use an immutable input environment.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertzk committed Aug 2, 2015
1 parent 74f52d2 commit 2404873
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions R/tundraContainer-initialize.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ initialize <- function(keyword, train_function = identity,
"stageRunner object.")
}

.keyword <<- keyword
.train_function <<- train_function
.predict_function <<- predict_function
.munge_procedure <<- munge_procedure
.default_args <<- default_args
.internal <<- internal
self$.keyword <<- keyword
self$.train_function <<- train_function
self$.predict_function <<- predict_function
self$.munge_procedure <<- munge_procedure
self$.default_args <<- default_args
self$.internal <<- internal

.input <<- list_to_env(list())
.output <<- list_to_env(list())
.internal <<- list_to_env(list())
self$.input <<- list_to_env(list())
lockEnvironment(self$.input)
self$.output <<- list_to_env(list())
self$.internal <<- list_to_env(list())
}

2 changes: 1 addition & 1 deletion R/tundraContainer-train.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ train <- function(dataframe, train_args = list(), verbose = FALSE, munge = TRUE)
output <- call_with(
self$.train_function,
list(dataframe),
list(input = self$.input, output = self$.output)
list(input = list_to_env(train_args, self$.input), output = self$.output)
)

private$run_hooks("train_finalize")
Expand Down

0 comments on commit 2404873

Please sign in to comment.