How can I implement neural networks in other programming languages?

You can convert a neural network to program code in either C or Fortran using the Mathematica commands CForm or FortranForm. This code can then be inserted into external programs. Here is an illustration of how to do this conversion on a feedforward network.

Load the package.

<< NeuralNetworks`

Generate some data.

Ndata = 20;
x = Table[10 N[{i/Ndata}], {i, 0, Ndata - 1}];
y =  Sin[x];

Generate a network.

fdfrwrd=InitializeFeedForwardNet[x, 
        y, {4}]

You can now obtain the program code by first producing a symbolic expression of the network and then using the Mathematica commands CForm or FortranForm.

Clear[xx]

The input to the network should be a list of symbols, one symbol for each input of the neural network. In this example there is only one input.

fdfrwrd[{xx}]

You can then produce the C code using the CForm command.

CForm[fdfrwrd[{xx}]]

Similarly, to create Fortran code use the FortranForm command.

FortranForm[CForm[fdfrwrd[{xx}]]]