Skip to content

Commit

Permalink
Merge pull request #270 from podTockom/devel
Browse files Browse the repository at this point in the history
Keras Module Issues
  • Loading branch information
nhejazi authored Mar 5, 2020
2 parents 63d0800 + a925fda commit fd2d36c
Show file tree
Hide file tree
Showing 65 changed files with 2,481 additions and 47 deletions.
17 changes: 8 additions & 9 deletions R/Lrnr_bilstm.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,21 @@ Lrnr_bilstm <- R6Class(
names(args$y) <- NULL

args$x <- kerasR::expand_dims(args$x, axis = 2)
args$y <- kerasR::expand_dims(args$y, axis = 2)
args$y <- kerasR::expand_dims(args$y, axis = 1)

num_samples <- dim(args$x)[1] # based on spliting the time series
num_steps <- dim(args$x)[2] # window
num_features <- dim(args$x)[3] # features = ts

# Build the model
model <- kerasR::Sequential()
keras::bidirectional(
object = model, layer = kerasR::LSTM(args$units,
return_sequences = TRUE
),
input_shape = c(num_steps, num_features)
)
# model$add(kerasR::Bidirectional(kerasR::LSTM(args$units,
# return_sequences = TRUE)))
#keras::bidirectional(
# object = model, layer = kerasR::LSTM(args$units,
# return_sequences = TRUE
# ),
# input_shape = c(num_steps, num_features)
#)
model$add(kerasR::Bidirectional(kerasR::LSTM(args$units,return_sequences = TRUE)))
model$add(kerasR::Dropout(rate = args$dropout))
model$add(kerasR::Flatten())
model$add(kerasR::Dense(args$dense))
Expand Down
4 changes: 2 additions & 2 deletions R/Lrnr_lstm.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Lrnr_lstm <- R6Class(
args$y <- as.numeric(sapply((args$window + 1):(dim(task$X)[1]), function(x) task$X[x]))

args$x <- kerasR::expand_dims(args$x, axis = 2)
args$y <- kerasR::expand_dims(args$y, axis = 2)
args$y <- kerasR::expand_dims(args$y, axis = 1)

num_samples <- dim(args$x)[1] # based on spliting the time series
num_steps <- dim(args$x)[2] # window
Expand All @@ -85,7 +85,7 @@ Lrnr_lstm <- R6Class(
epochs = args$epochs
)
fit_object <- model

return(fit_object)
},

Expand Down
41 changes: 41 additions & 0 deletions man/Custom_chain.Rd

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

42 changes: 42 additions & 0 deletions man/Lrnr_HarmonicReg.Rd

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

43 changes: 43 additions & 0 deletions man/Lrnr_arima.Rd

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

44 changes: 43 additions & 1 deletion man/Lrnr_bartMachine.Rd

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

42 changes: 42 additions & 0 deletions man/Lrnr_base.Rd

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

Loading

0 comments on commit fd2d36c

Please sign in to comment.