Modelling LR using CNTK
I am reading the tutorial shared here https://github.com/Microsoft/CNTK/wiki/Tutorial
Executed the example config (lr_ndl.cntk), taking the training and test data from the tutorial. cntk configFile=lr_ndl.cntk
I am getting this exception EXCEPTION occurred: randomizeRange must be an even multiple of mbSize and an integral factor of epochSize Log attached log.txt
I think I can help you about this. Modify the reader like this:
reader = [
#customDelimiter = " "
readerType = "UCIFastReader"
file = "Train.txt"
miniBatchMode = "partial"
verbosity = 1
randomize = "none"
features=[
dim = $dimension$
start = 0
]
labels=[
start = $dimension$ # skip $dimension$ elements before reading the label (i.e. the first two dimensions so we have "x1 x2 y" basically)
dim = 1 # label has 1 dimension
labelType=regression
labelMappingFile = "SimpleMapping.txt"
]
]
CNTK has bugs in the compiled binary package. When I use the binary of CNTK-2016-02-08, I also met this problem.
Hi. You shouldn't have to modify the config file at all. It might help in this particular case, but I'm running the latest build of CNTK and having no problems.
One thing I notice in your log is that you have some other models that are already trained in the same working directory. Because the config gives a model path, it found some already trained models there, and tried to continue with them. If there were any configuration changes, etc., then this would cause a problem. You should try deleting everything in the Models sub-folder and start training again from scratch.
If that does not work, then as the above poster mentions you may have a problem with your build. Personally I think it's always best to build from source to make sure all of your libraries are in the correct place, etc., but if there is a problem with the binary we will make sure new ones are posted ASAP. I will look into it. Thanks!
Thanks everyone! I am new to CNTK and started out by going through this tutorial. I had pulled in the source from git last week and built the binary, so I dont think its an issue seen from some old binary. I had to modify the reader as suggested. Deleting the model only did not resolve the issue. Also, I saw another error related to reader
EXCEPTION occurred: configparameters: required parameter missing: lr_ndl.cntk:Test:reader:labels:labelMappingFile
So my understanding was , if labelType=regression, label mapping file is not required. However, to remove this error I had to eventually provide an empty label mapping file.
After doing all these changes the example was executed successfully
This is my final config file lr_ndl.zip
Actually I found out that the cntk executable was being picked up from the bin package which I had downloaded earlier. I needed to modify my PATH variable to point to the latest bin which I was building :)
I dont see the label mapping file error anymore with the latest bin. But the original exception related to randomize range was still seen.
Also If I print the values ******** m_epochSize = 999,requestDataSize = -1,m_randomizeRange = 999,m_mbSize = 25 *********
Is the negative Data Size expected out2.txt
This is resolved then by making changes in config file for the reader randomize = "none"
Now there is no exception. However the error rate is quite high
EP: SquareError/Sample = 0.011546534
Square error is the sum of square errors across all dimensions. If your data has 100 dimensions, square error per dim would be just 1/100 of the number reported. You can also add Scale(Const(0.01), YourOrigNode) to your model and use this scaled one as your final criterion.
Since you turned off randomization in the reader, you’d better randomize your data offline.
I tried the multi class classification example next which uses softmax. even if I turn off rendomization in this case, still getting the same exception as before EXCEPTION occurred: randomizeRange must be an even multiple of mbSize and an integral factor of epochSize Log and config file attached 3Classes_ndl.zip out.txt
Can try setting the randomization method to be “none” instead of just omitting it? It seems it’s still doing randomization.
That helped. Thanks !