Train a RNN with strings using positive and negative samples I'm trying to recognize strings coming from a regular language, using positive and negative samples by Recurrent Neural Networks.

In particular, I tried to use the rnnlib by Alex Graves, but I had some troubles in changing the architecture of the network to adapt the network to my needs.

This is an example of my training set:

str1: w1 w2 ... wn --> label 1 (it is a valid string for the language)

str2: w1 w2 ... wi --> label 0 (it does not belong to the language)

where wi are drawn from the alphabet of the unknown language.

In other words, I'm trying to use RNN as a binary classifier.

Can you suggest a good tutorial or reference for this task?

Thanks in advance.
I think Sequence Classification with LSTM Recurrent Neural Networks in Python with Keras is one of the best tutorial available for this task. It does sentiment analysis on IMDB Dataset and is the simplest to understand. Also, it uses Keras framework which I use right now because of it's simplicity and it's online support and documentation available. The RNN of keras has multiple options which you can explore based on your requirement. Also, keras make it real easy to use an optimizer from a wide variety of options.