Closed akanksha0011 closed 8 years ago
Hello,
you have mixed the interfaces from version 0.9.1 and 0.10.0, and you are not actually fine-tuning the network (only pre-training for two epochs). Assuming you are using version 0.10.0, your code (after the data preparation) can be simplified to
trainedModel <- darch(input, output, c(9,5,4,3,2,1), rbm.batchSize = 2,
rbm.genWeightFunction = generateWeights, rbm.numEpochs = 2,
darch.numEpochs = 50, darch.fineTuneFunction = rpropagation,
darch.initialMomentum = 0.5, darch.finalMomentum = 0.9,
darch.momentumSwitch = 5, darch.learnRateWeights = 0.1,
darch.learnRateBiases = 0.1)
final_outputs <- predict(trainedModel)
The important change here is to set darch.numEpochs
to something other than 0 (50, in my example). If you still don't get any useful results, you could try
I hope this helps.
Closing for inactivity, please open a new issue if anything else comes up.
Hi saviola
I am trying this code on darch.i am using getExecuteFunction and getOutputs to obtain the output for test_data set.But I am getting a single output value for all the units.Can you please guide me on this?
library(darch)
dt = read.csv("C:/Documents/sample_1.csv") tot<-nrow(dt) devrec<-as.integer(0.7*tot) devr<-sample(tot,devrec) dev<-dt[devr,] val<-dt[-devr,]
darch <- newDArch(c(2,4,1),batchSize=2) input = dev[,c("x2","x11","x29","x31","x32","x33","x34","x35","x36")] output = dev[,"Target"] data_in <- darch(input,output,c(9,5,4,3,2,1), rbm.batchSize = 2, rbm.genWeightFunction = generateWeights, rbm.numEpochs = 2, darch.numEpochs = 0,darch.fineTuneFunction = rpropagation,darch.initialMomentum = 0.5, darch.finalMomentum = 0.9,darch.momentumSwitch = 5, darch.learnRateWeights = 0.1,darch.learnRateBiases = 0.1) predictions <- predict(data_in) predictions
trainData <- applyDropoutMask(trainData,getDropoutMask(darch, 0)) test_data = val[,c("x2","x11","x29","x31","x32","x33","x34","x35","x36")] test_data = as.matrix(test_data) exec_fn<-getExecuteFunction(data_in)(data_in,test_data) outputs <- getExecOutputs(exec_fn) final_outputs = print(outputs[[length(outputs)]]) final_outputs
This gives an output
0.9786744 0.9786744 0.9786744 0.9786744 . .. 180 times