Q&A - ntuanhung/rnnlib-plus GitHub Wiki

Q&A from the origin

Environment:

RNNLIB (version 2011-01-06) on a ubuntu 11.04 i5T2500K machine
netcdf 2.8-1.2.build2
python-scientific-2.8-1.2.build2
python-sci-tools 0.8-1
python-sci-py 0.8.0+dfsg1-1ubuntu11
python-imaging 1.1.7-2build2 (PIL)

Q: It seems that the arabic-online/offline example do not converge (label error ~96%)(using given configs). Is this a bug? I also tested the code with some old IAM-OnDb dataset (only 10 samples), which does not seem to work either. (btw. these samples are perfectly classified with some old BLSTM connectionist code partly written on my own after ~13epochs). Has anybody got the same results on the Arabic examples?

A: I tested Arabic samples successfully.

Q: I am going to test rnnlib from IAM-DB or IAM-onDB. But I don't know how I can testing rnnlib from xml format. Could you teach me about that? Do I have to make .config file from .xml file? I already tested example arabic-online/offline by using netcdf. And I installed netcdf, python-scientific, sci-tool, sci-py, imaging.

A: You need to insert a new XML reader to read sequence and push into vector of DataSequence as in NetcdfDataset.hpp.

Q: I need your help to know how to script rnn for following kind of data: I have 'n' (say 10) text files of data. Each file have 360 rows and 3 columns i.e. (feature dimension is = 3) e.g.

1 2 3;
2 3 4;
5 6 7;
........;
........;

i have corresponding 'n' (here 10) text files which contain a label for each data file.

'circle'
'square'
'cone'
.........;
.........;

Please help me to model this problem to input to rnnlib.

A: TBA

Q: Please help me find how to configure rnn to test the data using top 5% choice. it defaults gives results with top 1% I think.

A: Do you consider top-1 and top-5 results? In case of sequence classification task, RNNLIB only output top-1 result as default. To get all probabilities, you could use --verbose True

Q: How do we generate posterior probabilities of given features from the given 'save' files?

A: TBA

6. Help with installation

Cygwin/Mingw clang gcc on Suse mac os

Q: I could make RNNlLIB neither in Cygwin nor in Mingw. I am trying to compile the RNNLIB tool, and a problem has occurred:

$ make
make all-recursive
make[1]: Entering directory 
'/cygdrive/c/cygwin64/home/baoxwang/rnnlib/rnnlib_source_forge_version'
Making all in src
make[2]: Entering directory 
'/cygdrive/c/cygwin64/home/baoxwang/rnnlib/rnnlib_source_forge_version/src'
g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/include/boost/ -MT DataExporter.o 
-MD -MP -MF .deps/DataExporter.Tpo -c -o DataExporter.o DataExporter.cpp
In file included from DataExporter.hpp:24:0,
from DataExporter.cpp:18:
Helpers.hpp:150:21: error: ‘const real_t infinity’ redeclared as 
different kind of symbol
static const real_t infinity = numeric_limits<real_t>::infinity();
^
In file included from /usr/lib/gcc/x86_64-pc-
cygwin/4.8.2/include/c++/cmath:44:0,
from /usr/include/boost/config/no_tr1/cmath.hpp:21,
from /usr/include/boost/date_time/posix_time/posix_time_config.hpp:15,
from /usr/include/boost/date_time/posix_time/posix_time_system.hpp:13,
from /usr/include/boost/date_time/posix_time/ptime.hpp:12,
from /usr/include/boost/date_time/posix_time/posix_time.hpp:15,
from /usr/include/boost/date_time/local_time/local_time.hpp:11,
from /usr/include/boost/date_time.hpp:15,
from Helpers.hpp:21,
from DataExporter.hpp:24,
from DataExporter.cpp:18:
/usr/include/math.h:258:15: error: previous declaration of ‘double infinity()’
extern double infinity _PARAMS((void));
^
Makefile:230: recipe for target 'DataExporter.o' failed
make[2]: [DataExporter.o] Error 1
make[2]: Leaving directory 
'/cygdrive/c/cygwin64/home/baoxwang/rnnlib/rnnlib_source_forge_version/src'
Makefile:224: recipe for target 'all-recursive' failed
make[1]: [all-recursive] Error 1
make[1]: Leaving directory 
'/cygdrive/c/cygwin64/home/baoxwang/rnnlib/rnnlib_source_forge_version'
Makefile:163: recipe for target 'all' failed
make: *** [all] Error 2

A: Visual Studio project for Windows

Q: I'm trying to get things going with rnnlib and I'm having a hard time; I've installed all the dependencies successfully, but I'm running into several compiling errors with rnnlib, while compiling with clang on Mac OSX 10.10. Some of them are just a matter of moving parts of code above or below; but I don't seem to be able to solve all troubles. I've come across a few posts giving some instruction on how to patch things up for gcc, but nothing about clang. Is there any clang-ready rnnlib release? Does anybody has a hint to point me in the right direction?

Q: I am trying to compile the lib on Suse Linux with downgraded Boost and GCC dependencies, as specified in the doc.

CXXFLAGS=-I/foo/boost_1_36_0/ CXX=g++-3.3 CC=gcc-3.3 ./configure
Automake is still >1.10, but in the configure script there is an explicit comment about this version, so I guess automake 1.9 is not a requirement anymore.
I am getting the following output. Does someone have an idea?
make  all-recursive
make[1]: Entering directory `/foo/rnnlib'
Making all in src
make[2]: Entering directory `/foo/rnnlib/src'
g++-3.3 -DHAVE_CONFIG_H -I. -I..     -I/foo/boost_1_36_0/ -MT Main.o -MD -MP -MF .deps/Main.Tpo -c -o Main.o Main.cpp
In file included from MultiArray.hpp:30,
                 from SeqBuffer.hpp:21,
                 from Layer.hpp:22,
                 from InputLayer.hpp:21,
                 from Mdrnn.hpp:21,
                 from MultilayerNet.hpp:21,
                 from Main.cpp:20:
Helpers.hpp: In function `void print_time(double, std::ostream&, bool)':
Helpers.hpp:175: warning: initialization to `int' from `double'
Helpers.hpp:175: warning: argument to `int' from `double'
In file included from Mdrnn.hpp:29,
                 from MultilayerNet.hpp:21,
                 from Main.cpp:20:
BlockLayer.hpp: In member function `virtual void BlockLayer::start_sequence()':
BlockLayer.hpp:58: warning: assignment to `long unsigned int' from `double'
BlockLayer.hpp:58: warning: argument to `long unsigned int' from `double'
In file included from Mdrnn.hpp:30,
                 from MultilayerNet.hpp:21,
                 from Main.cpp:20:
NetcdfDataset.hpp: In member function `void DataList::print(std::ostream&) 
   const':
NetcdfDataset.hpp:630: warning: initialization to `int' from `real_t'
NetcdfDataset.hpp:630: warning: argument to `int' from `real_t'
NetcdfDataset.hpp:634: warning: initialization to `int' from `const double'
NetcdfDataset.hpp:634: warning: argument to `int' from `const double'
NetcdfDataset.hpp:640: warning: initialization to `int' from `real_t'
NetcdfDataset.hpp:640: warning: argument to `int' from `real_t'
NetcdfDataset.hpp:644: warning: initialization to `int' from `const double'
NetcdfDataset.hpp:644: warning: argument to `int' from `const double'
In file included from MultilayerNet.hpp:22,
                 from Main.cpp:20:
ClassificationLayer.hpp: In member function `virtual real_t 
   BinaryClassificationLayer::set_error(int, int)':
ClassificationLayer.hpp:155: error: conversion to non-const reference type `
   struct View<real_t>&' from rvalue of type `View<real_t>'
In file included from Main.cpp:24:
Helpers.hpp: In function `boost::integer_range<typename 
   boost::range_size<T>::type> indices(const R&) [with R = std::vector<real_t, 
   std::allocator<real_t> >]':
SteepestDescent.hpp:51:   instantiated from here
Helpers.hpp:346: error: conversion from `boost::integer_range<long int>' to 
   non-scalar type `boost::integer_range<long unsigned int>' requested
In file included from Main.cpp:26:
Helpers.hpp: In function `boost::integer_range<typename 
   boost::range_size<T>::type> indices(const R&) [with R = Vector<real_t>]':
Trainer.hpp:210:   instantiated from here
Helpers.hpp:346: error: conversion from `boost::integer_range<long int>' to 
   non-scalar type `boost::integer_range<long unsigned int>' requested
Helpers.hpp: In function `boost::integer_range<typename 
   boost::range_size<T>::type> indices(const R&) [with R = Vector<size_t>]':
SeqBuffer.hpp:104:   instantiated from `void CoordIterator<R>::begin() [with R = View<const size_t>]'
SeqBuffer.hpp:43:   instantiated from `CoordIterator<R>::CoordIterator(const R&, const std::vector<int, std::allocator<int> >&, bool) [with R = View<const size_t>]'
SeqBuffer.hpp:183:   instantiated from `CoordIterator<View<const size_t> > SeqBuffer<T>::begin(const std::vector<int, std::allocator<int> >&) const [with T = real_t]'
Layer.hpp:90:   instantiated from here
Helpers.hpp:346: error: conversion from `boost::integer_range<long int>' to 
   non-scalar type `boost::integer_range<long unsigned int>' requested
Helpers.hpp: In function `boost::integer_range<typename 
   boost::range_size<T>::type> indices(const R&) [with R = std::vector<int, 
   std::allocator<int> >]':
Mdrnn.hpp:282:   instantiated from here
Helpers.hpp:346: error: conversion from `boost::integer_range<long int>' to 
   non-scalar type `boost::integer_range<long unsigned int>' requested
Helpers.hpp: In function `boost::integer_range<typename 
   boost::range_size<T>::type> indices(const R&) [with R = std::vector<Layer*, 
   std::allocator<Layer*> >]':
Mdrnn.hpp:301:   instantiated from here
Helpers.hpp:346: error: conversion from `boost::integer_range<long int>' to 
   non-scalar type `boost::integer_range<long unsigned int>' requested
Helpers.hpp: In function `boost::integer_range<typename 
   boost::range_size<T>::type> indices(const R&) [with R = 
   std::vector<std::vector<int, std::allocator<int> >, 
   std::allocator<std::vector<int, std::allocator<int> > > >]':
ClassificationLayer.hpp:75:   instantiated from here
Helpers.hpp:346: error: conversion from `boost::integer_range<long int>' to 
   non-scalar type `boost::integer_range<long unsigned int>' requested
make[2]: *** [Main.o] Error 1
make[2]: Leaving directory `/foo/rnnlib/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/foo/rnnlib'
make: *** [all] Error 2

Q:

$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in src
g++ -DHAVE_CONFIG_H -I. -I.. -Qunused-arguments -g -O2 -MT DataExporter.o -MD -MP -MF .deps/DataExporter.Tpo -c -o DataExporter.o DataExporter.cpp
In file included from DataExporter.cpp:18:
In file included from ./DataExporter.hpp:24:
./Helpers.hpp:724:18: error: expected expression
out << t.get<0>() << " " << t.get<1>();
^
./Helpers.hpp:724:39: error: expected expression
out << t.get<0>() << " " << t.get<1>();
^
./Helpers.hpp:729:18: error: expected expression
out << t.get<0>() << " " << t.get<1>() << " " << t.get<2>();
^
./Helpers.hpp:729:39: error: expected expression
out << t.get<0>() << " " << t.get<1>() << " " << t.get<2>();
^
./Helpers.hpp:729:60: error: expected expression
out << t.get<0>() << " " << t.get<1>() << " " << t.get<2>();
^
./Helpers.hpp:734:18: error: expected expression
out << t.get<0>() << " " << t.get<1>() << " " << t.get<2>() << ...
^
./Helpers.hpp:734:39: error: expected expression
out << t.get<0>() << " " << t.get<1>() << " " << t.get<2>() << ...
^
./Helpers.hpp:734:60: error: expected expression
...<< t.get<0>() << " " << t.get<1>() << " " << t.get<2>() << " " << t.get<...
^
./Helpers.hpp:734:81: error: expected expression
...<< " " << t.get<1>() << " " << t.get<2>() << " " << t.get<3>();
^
./Helpers.hpp:739:18: error: expected expression
out << t.get<0>() << " " << t.get<1>() << " " << t.get<2>() << ...
^
./Helpers.hpp:739:39: error: expected expression
out << t.get<0>() << " " << t.get<1>() << " " << t.get<2>() << ...
^
./Helpers.hpp:739:60: error: expected expression
...<< t.get<0>() << " " << t.get<1>() << " " << t.get<2>() << " " << t.get<...
^
./Helpers.hpp:739:81: error: expected expression
...<< t.get<1>() << " " << t.get<2>() << " " << t.get<3>() << " " << t.get<...
^
./Helpers.hpp:739:102: error: expected expression
...<< " " << t.get<2>() << " " << t.get<3>() << " " << t.get<4>();
^
In file included from DataExporter.cpp:18:
In file included from ./DataExporter.hpp:25:
In file included from ./SeqBuffer.hpp:21:
In file included from ./MultiArray.hpp:31:
./Container.hpp:113:14: warning: reference 'front' is not yet bound to a value
when used within its own initialization [-Wuninitialized]
T& front = front();
~~~~~ ^~~~~
1 warning and 14 errors generated.
make[2]: [DataExporter.o] Error 1
make[1]: [all-recursive] Error 1
make: *** [all] Error 2

**Q:**I think we all want to know what the RNNLIB predict the samples. However, there is no predition labels or files using the RNNLIB. How to get the prediction labels by the RNNLIB?

**A:**The answer (https://sourceforge.net/p/rnnl/discussion/1183966/thread/fe04fff0/#a8f5) expands using the offline Arabic handwriting example. In a terminal, navigate to the directory "rnnlib_source_forge_version/examples/arabic_offline_handwriting". Execute the following commands:

./build_netcdf.sh
rnnlib --autosave=true --maxTestsNoBest=7 transcription.config

The value for the parameter "maxTestsNoBest" doesn't matter much. I arbitrarily set it to "7", so I can obtain a neural network which can likely predict a nonempty sequence with relatively little training time. Among other files, one with a name similar to "[email protected]_ctcError.save" should appear. The date/time part will be different. After training ends, execute the following command:

dump_sequence_variables.sh transcription\@2015.06.06-14.32.51.884793.best_ctcError.save arabic_offline.nc 1

Note that the command above only works if you add the directory "rnnlib_source_forge_version/utils" to your Linux "$PATH" variable. Also note that this command predicts the labels on the sequence "aj15_065.tif" from the training data, "arabic_offline.nc". Near the end of the text dumped to stdout by the script "dump_sequence_variables.sh", you should see the line starting with "output label sequence". Below that line is the predicted sequence of labels you desire. In my case, it happens to be "raE heB zaM laB seB". RNNLIB saves the predicted sequence in file with a name similar to the following:

[email protected]_ctcError.save_arabic_offline.nc_1/log

If the predicted sequence has length zero, try training the neural network with a higher value for "maxTestsNoBest".

Q: After running the below command, I got the following error please help me to resolve this if anyone knows.

dump_sequence_variables.sh [email protected]_ctcError.save arabic_offline.nc 1
ERRROR: arabicoffline.nc given as 'dataset' parameter in config file 'DISPLAYTMP'
must be one of 'train test val'
rnnlib: Main.cpp:73: int main(int, char): Assertion `(in(validDatasets, dataset))' failed.

A: TBA

Q: I created a dummy set of sequences to test the rnnlib. My sequences are all made of 4 random floats, each float taking a value in corresponding to the following labels. There is no way I can make the rnn converge. The output label sequence is almost always empty… anyone want to give it a try ? anyone manages to make this lib work?

A: First, you should declare your task. Then, check out the corresponding example provided in "samples" folder.

10. Multidimensional transcription task

Q1 Q2

Q1: I'm trying to use rnnlib for MD transcription task. I've been using 1D LSTM for transcription task for a while now and know how to make ncFiles and use various utilities. The main parameter in 1D-LSTM setting is the hidden size. I'm wondering how can I set various parameters in the config file, like subsamplSize, hiddenBlock, inputBlock, etc. when using MD-LSTM network. My output is 125 labels. Currently, I'm just doing hit-and-trial, training a lot many networks with various combinations of these parameters. But I hope that there should be a way to reasonably set these parameters before starting experiments depending upon the task at hand.

Q2: I'm trying to run rnnlib for 2D transcription task (similar to the Arabic offline handwriting example), but I'm getting the following error:

rnnlib: TranscriptionLayer.hpp:166: virtual real_t TranscriptionLayer::calculate_errors(const DataSequence&): Assertion `(logProb.log() <= 0)' failed.
Aborted (core dumped)

I've no idea why this happening? and how can I fix that? Am I doing something wrong while making ncFile (pretty much similar to what is given in example), or something is wrong with my images (I've tried running with both gray-value between 0-255 and 0-1)? I'll be grateful if someone can help me in this regard.

A: TBA

Q: I'm working on a 2-class classification problem, where data distribution is highly skewed (99% to 1%). I need to incorporate cost-matrix. Is there a way to incorporate such a cost-matrix into my ncFiles?

A: TBA

Q: When attempting to compile RNNLib, I got an error in NetcdfDataset.hpp:26:24 saying that Netcdfcpp.h could not be found. I looked around and found a bug report from 2011 that suggested that this was a bug, but it claimed to have been fixed. I have tried everything I can think of, including rebuilding NetCDF with various different flags, and have been unable to fix this bug. Can anyone give me a hand?

A: This file is no longer in use in the newest version. Therefore, use ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-cxx-4.2.tar.gz

Q: -----------------------------------------------------------------------------------

$ make
make all-recursive
make[1]: Entering directory /home/tiago/rnnlib_source_forge_version' Making all in src make[2]: Entering directory/home/tiago/rnnlib_source_forge_version/src'
g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT DataExporter.o -MD -MP -MF .deps/DataExporter.Tpo -c -o DataExporter.o DataExporter.cpp
In file included from DataExporter.cpp:18:0:
DataExporter.hpp:21:38: fatal error: boost/concept/requires.hpp: No such file or directory compilation terminated.
make[2]: *** [DataExporter.o] Error 1
make[2]: Leaving directory /home/tiago/rnnlib_source_forge_version/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/home/tiago/rnnlib_source_forge_version'
make: * [all] Error 2

A: "I am not in any way affiliated with this project, so I offer this with no warranty, but I ran into the same issue and I think I've fixed it. The problem is in the "indices" function in Helpers.hpp. On the line 344, change range_size to range_difference, and it should compile.

The problem is that boost::size<R> returns a range_difference<R>::type, not a range_size<R>::type. It could be that this is a recent change to Boost, so if Alex was using an outdated version of Boost, he wouldn't have caught it."

Q: hello i just use make the rnnlib in the windows , use vs2008, howerver there is some mistake happened when the rnnlib is running in the feed_forward_layer, for "vector subscript out of range" in return View<T>(&((*this)), &((*this))); in container.hpp, I just run the arabic_offline.nc, whether VS2008 is not available.

A: The problem is that the line:

return View<T>(&((*this)[first]), &((*this)[last]));

attempts to obtain pointers to the beginning ('first') and end ('last') of the slice using vector::operator[](), which in the MSVC implementation checks if the index is within the range [0;size]. As the code before this line already makes sure 'first' and 'last' are within bounds (up to and including size), a solution is to rewrite the line as:

return View<T>(&((*this)[0]) + first, &((*this)[0]) + last);

Alternatively, there are defines that disable index checking, e.g. _ITERATOR_DEBUG_LEVEL=0 for MSVC2010.

Q: while training my data, I am getting a warning like this

warning, seq "my_image_path" has requiredTime 18 > totalTime 10

Could someone tell me how to remove this??

A: TBA

Q: Does anyone know if it possible to compile rnnlib as a shared library? The problem is it is a rather complex configuration...

A: Yes. It is possible.

Q: On profiling I observed that the computation expensive steps of rnnlib are matrix operations like dot, outer etc..any idea how to integrate/use MKL libraries with rnnlib for faster execution.

A: TBA

Q: I am trying to implement RNNlib for my master's project and I have already trained the network for the given example for arabic_offline_handwriting. I was wondering whether I have to create a testing file by myself or it's already present? and can somebody please explain me the transcription.config file. I could not find any description about that file.

A: You just have to go into the folder and run ./build_netcdf then a config file is created which you then can execute with rnnlib *.config

Q: After training a network, I am interested in using it in an online classification system that receives inputs in real-time and is expecting the network to provide a stream of classification outputs. I assume this is not possible with the command line rnnlib but is it doable by linking directly with the rnnlib code and perhaps calling in a systematic way some of the top level functions?

Q: I'm new to study recurrent neural networks and now confused by the parameters in RNNLib. Specifically, I don't understand the hidden Block, hidden size, input Block, subsample size and stuffs with mdl. In my experience, I just had input vectors, one lstm hidden layer and softmax output layer. Why does the block seem like a matrix?

Q: I am using your rnnlib toolkit to do offline handwriten recognition task. But the files such as wordtranscriptionlayer.hpp is not in the current version. An earlier version on github has these files but is not complete. Anyone has the complete version?

Q: I built RNNLIB successfully, and was going to run the examples. I did

./build_netcdf.sh
rnnlib *.config

and got the following error:

dyld: lazy symbol binding failed: Symbol not found: _nc__open
Referenced from: /usr/local/lib/libnetcdf_c++.4.dylib
Expected in: flat namespace
dyld: Symbol not found: _nc__open
Referenced from: /usr/local/lib/libnetcdf_c++.4.dylib
Expected in: flat namespace
Trace/BPT trap: 5

Does anyone have any idea how to solve this? I'm running on Mac OSX 10.9.5, and installed netcdf via macports. Any suggestion is appreciated.

A: uninstall and re-install netcdf c++ and the problem is solved.

Q: I'm working on building an auto-encoder with a recurrent neural network. In the wiki page (http://rnnlib.wikinet.org/wiki/Main_Page), I saw instructions (data file format section) that mentioned it was possible to build a network for a regression task : "R = regression (sum-of-squares error with linear outputs)", but actually, there is no possibility to indicate this task in the '.config' file, it returns an error if I try to configure a "regression" task... Does someone have an idea of how to configure the '.config' file for this task ?

A: It seems that regression is not possible in the version shared on Sourceforge. However, I found another version on github which seems to allow regression : https://github.com/meierue/RNNLIB MultiLayerNet.hpp now allows regression (https://github.com/meierue/RNNLIB/blob/master/src/MultilayerNet.hpp).

I have completed to compile the rnnlib which supplies the regression task. I also made dataset as netCDF format for the regression but, it dosen't work due to leak of memory (this task was killed). I want to use rnn model without any option such as sub-sampling, hidden block. How can I write the config file for my task. Is there anyone who can help me?

Q: I want to add more features to the input data file. I am editing the example file "arabic_offline_handwriting". In that there was only one feature as input. I want to give 6 features. I figured out two ways to give input,

  1. making inputs as 6 dimensional, i.e, input[][6].
  2. using input1[] input2[] input3[] input4[] input5[] input6[]. which of the above method will work?? My __.config file was like:
task transcription
hiddenType lstm
trainFile arabic_offline.nc
hiddenSize 2,10,50
subsampleSize 6,20
hiddenBlock 3,4;2,4
inputBlock 3,4
learnRate 1e-4
momentum 0.9
optimiser steepest

can you tell me after using one of the above appropriate input methods, where I have to change? can please explain the meaning of these also:

hiddenSize 2,10,50
subsampleSize 6,20
hiddenBlock 3,4;2,4
inputBlock 3,4

why the parameters are list f integers, not simply integer??

Q:

g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT Main.o -MD -MP -MF .deps/Main.Tpo -c -o Main.o Main.cpp
In file included from MultiArray.hpp:30:0,
from SeqBuffer.hpp:21,
from Layer.hpp:22,
from InputLayer.hpp:21,
from Mdrnn.hpp:21,
from MultilayerNet.hpp:21,
from Main.cpp:20:
Helpers.hpp: In instantiation of ‘std::pair<boost::zip_iterator<boost::tuples::tuple<typename boost::range_iterator<C="">::type, typename boost::range_iterator<R2>::type, typename boost::range_iterator<R3>::type> >, boost::zip_iterator<boost::tuples::tuple<typename boost::range_iterator<C="">::type, typename boost::range_iterator<R2>::type, typename boost::range_iterator<R3>::type> > > zip(R1&, R2&, R3&) [with R1 = std::vector<int>; R2 = std::vector<bool>; R3 = std::vector<int>; typename boost::range_iterator<R3>::type = gnu_cxx::normal_iterator<int*, std::vector<int=""> >; typename boost::range_iterator<R2>::type = std::_Bit_iterator; typename boost::range_iterator<C>::type = gnu_cxx::normal_iterator<int*, std::vector<int=""> >]’:
Mdrnn.hpp:239:6: required from here
Helpers.hpp:311:41: error: ‘range_min_size’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
size_t size = range_min_size(r1, r2, r3);
^

A: Change position of this function to be before it is invoked.

Q:

Container.hpp:157:24: error: ‘resize’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
Container.hpp:157:24: note: declarations in dependent base ‘std::vector<long unsigned="" int="">’ are not found by unqualified lookup
Container.hpp:157:24: note: use ‘this->resize’ instead
Makefile:230: recipe for target 'Main.o' failed
make: *** [Main.o] Error 1

A: Go to container.hpp line no- 157 then change resize to this->resize.

Q: In my training data, I tried to add an extra sequence of similar target labels (e.g., "A A A A A .....") at the beginning of each targetsequences because I wanted to try to conduct an experiment using a full-delay concept. Then, I figured out that the variable requiredTime in the TranscriptionLayer.hpp is increased depending on the number of that extra sequence because of the following loop:

LOOP(int label, seq.targetLabelSeq)
{
   if (label == oldLabel)
   {
      ++requiredTime; //WHY THIS IS IMPORTANT?
   }
   oldLabel = label;
}

This caused a problem during the model training because it displayed a warning

out << "warning, seq " << seq.tag << " has requiredTime " << requiredTime << " > totalTime " << totalTime << endl;

Then, I would like to omit that condition, but I did not understand what was the advantage of this code.

A: This is to make sure that there are 2*len(targetSequence)+1 characters since blank is able to lie between two adjacent characters.

Q: Is there a way to configure initial weight values or to specify the connection matrix for the NN?

A: Yes. For the original version, the uniform distribution is used to initial weights in the range [-0.1, 0.1].

Q: I see that the documentation mentions using autosave to recover and continue an interrupted training session. I would like to do that, but I can't seem to find how to start training with a saved network.

A: You can just use rnnlib test1.last.save to resume training from last saved network.

Q: While testing as sequence classification task, I am getting the following error for a part of the test data:

rnnlib: DatasetErrors.hpp:40: void DatasetErrors::add_error(std::string, real_t, real_t): Assertion `(boost::math::isfinite(error))' failed.
ERRROR: crossEntropyError has value inf

I donot understand crossEntropy, so quite clueless how to go about this issue.

A: First of all, you should check weight values to make sure that there is no Inf weight. Next, check your input data as well. Finally, you could try to check the outputActivation values of each layer to detect when and where Inf value appeared.

31.

⚠️ **GitHub.com Fallback** ⚠️