You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/08/23 11:15:35 UTC

[GitHub] dma100180 opened a new issue #7560: Creating a layer-by-layer network

dma100180 opened a new issue #7560: Creating a layer-by-layer network
URL: https://github.com/apache/incubator-mxnet/issues/7560
 
 
   
   [MyData2.zip](https://github.com/apache/incubator-mxnet/files/1242794/MyData2.zip)
   
   Hi, I have a model of a layer that I would like to train, to then use both weights and Bias as a parameter to create a new layer:
   
   DataNeurona<- read.csv("D:/DATOS_PROYECTO/MyData2.csv",sep = ",", header = T)
   DataNeurona<-as.matrix(DataNeurona)
   DataNeurona<-rbind(DataNeurona,DataNeurona[length(DataNeurona[,1]),])
   
   NumTest<-2
   train.ind<-c(41:(length(DataNeurona[,1])-NumTest))
   train.x<-DataNeurona[train.ind,-(length(DataNeurona[1,]))]
   train.y<-DataNeurona[train.ind,length(DataNeurona[1,])]
   test.x<-DataNeurona[-c(1:41,train.ind),-length(DataNeurona[1,])]
   test.y<-DataNeurona[-c(1:41,train.ind),length(DataNeurona[1,])]
   
   data <- mx.symbol.Variable("data")
   #w = mx.symbol.Variable('myweight')
   
   fc1<-mx.symbol.FullyConnected(data, name="fc1", num_hidden=25, weights(ww))
   act1<-mx.symbol.Activation(fc1,name="sigmoid1",act_type="sigmoid")
   
   fc7<-mx.symbol.FullyConnected(act2,name="fc7",num_hidden=1)
   lro=mx.symbol.LinearRegressionOutput(data=fc7, grad.scale=1)
   mx.set.seed(0)
   train_iter = mx.io.arrayiter(data = t(train.x), label = t(train.y))
   model <- mx.model.FeedForward.create(symbol= lro, 
                                        X=train_iter, 
                                        ctx=mx.cpu(2),     
                                        num.round=250,
                                        #optimizer = 
                                        initialize=mx.init.uniform(0.7),
                                        array.batch.size=3,
                                        learning.rate=0.01, 
                                        momentum=0.9,  
                                        eval.metric=mx.metric.mse)
   
   
   My problem is that I can not find the way to create the layer later with the weights as parameter, 
   I have tried with:
   
   1
   model$arg.params$fc1_weight
   fc1<-mx.symbol.FullyConnected(data, name="fc1", num_hidden=25, weights(model$arg.params$fc1_weight))
   2
   
   
   model$arg.params$fc1_weight
   fc1<-mx.symbol.FullyConnected(data, name="fc1", num_hidden=25, weights=model$arg.params$fc1_weight, bias=model$arg.params$fc1_bias)
   3
   model$arg.params$fc1_weight
   fc1<-mx.symbol.FullyConnected(data, name="fc1", num_hidden=25, weights=model$arg.params[[fc1_weight]], bias=model$arg.params[[fc1_bias]])
   4
   model.extract(model, "weights")
   
   ## ## ### **
   
   **
   And I do not quite understand what I do wrong ....
   Greeting
   
 
----------------------------------------------------------------
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