You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/20 22:51:21 UTC

[GitHub] anirudhacharya commented on a change in pull request #12263: [MXNET-628] Fix example on text classification using LSTMs on IMDB dataset

anirudhacharya commented on a change in pull request #12263: [MXNET-628] Fix example on text classification using LSTMs on IMDB dataset
URL: https://github.com/apache/incubator-mxnet/pull/12263#discussion_r211430732
 
 

 ##########
 File path: example/rnn/bucket_R/aclImdb_lstm_classification.R
 ##########
 @@ -40,20 +40,31 @@ optimizer <- mx.opt.create("adadelta", rho = 0.92, epsilon = 1e-06, wd = 2e-04,
 bucket_list <- unique(c(train.data$bucket.names, eval.data$bucket.names))
 
 symbol_buckets <- sapply(bucket_list, function(seq) {
-  rnn.graph(config = "seq-to-one", cell_type = "lstm", 
-            num_rnn_layer = 1, num_embed = 2, num_hidden = 6, 
-            num_decode = 2, input_size = vocab, dropout = 0.5, 
-            ignore_label = -1, loss_output = "softmax",
-            output_last_state = F, masking = T)
+  rnn.graph(config = "seq-to-one",
+            cell_type = "lstm",
+            num_rnn_layer = 1,
+            num_embed = 2,
+            num_hidden = 6,
+            num_decode = 2,
+            input_size = vocab,
+            dropout = 0.2,
+            ignore_label = -1,
+            loss_output = "softmax",
+            output_last_state = F,
+            masking = T)
 })
 
 model_sentiment_lstm <- mx.model.buckets(symbol = symbol_buckets,
-                          train.data = train.data, eval.data = eval.data,
-                          num.round = num.round, ctx = devices, verbose = FALSE,
-                          metric = mx.metric.accuracy, optimizer = optimizer,  
-                          initializer = initializer,
-                          batch.end.callback = NULL, 
-                          epoch.end.callback = epoch.end.callback)
+                                         train.data = train.data,
+                                         eval.data = eval.data,
+                                         num.round = num.round,
+                                         ctx = devices,
+                                         verbose = FALSE,
+                                         metric = mx.metric.accuracy,
+                                         optimizer = optimizer,
+                                         initializer = mx.init.Xavier(rnd_type = "gaussian", factor_type = "in", magnitude = 2),
 
 Review comment:
   it did not break any lint check, but i will split it up into different lines.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services