thirdwing commented on issue #7364: MxnetR chunk-wise neural nets
URL: 
https://github.com/apache/incubator-mxnet/issues/7364#issuecomment-321406878
 
 
   @train-test-laura If you are using the same model over different chunks of 
data, you can do something similar to below:
   
   ```r
   data(BostonHousing, package = "mlbench")
   
   train.ind <- seq(1, 506, 3)
   train.x <- data.matrix(BostonHousing[train.ind,-14])
   train.y <- BostonHousing[train.ind, 14]
   test.x <- data.matrix(BostonHousing[-train.ind,-14])
   test.y <- BostonHousing[-train.ind, 14]
   
   train.x2 <- train.x
   train.y2 <- train.y
   
   library(mxnet)
   
   data <- mx.symbol.Variable("data")
   fc1 <- mx.symbol.FullyConnected(data, num_hidden = 1)
   lro <- mx.symbol.LinearRegressionOutput(fc1)
   
   mx.set.seed(0)
   model <- mx.model.FeedForward.create(lro,
                                        X = train.x,
                                        y = train.y,
                                        ctx = mx.cpu(),
                                        num.round = 50,
                                        array.batch.size = 20,
                                        learning.rate = 2e-6,
                                        momentum = 0.9,
                                        eval.metric = mx.metric.rmse)
   
   model2 <- mx.model.FeedForward.create(lro,
                                         X = train.x2,
                                         y = train.y2,
                                         ctx = mx.cpu(),
                                         num.round = 50,
                                         array.batch.size = 20,
                                         learning.rate = 2e-6,
                                         momentum = 0.9,
                                         eval.metric = mx.metric.rmse,
                                         arg.params = model$arg.params,
                                         aux.params = model$aux.params)
   ```
   
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to