It wasn’t too difficult to implement a conventional neuroevolution (CNE) trainer addin for convnet.js, since the existing structure of the code was beautifully designed and I can just follow and create a similar method that looks similar to existing backprop/SGD trainers.

I modified the previous interactive data fitting demo to demonstrate that my CNE trainer works to fit a 2D data set as well.  It won’t work as well and as efficiently as SGD methods, since it is missing the gradient information, but I just want to test that it can still find a solution to fit the data that works well, and then apply this algorithm to the pendulum problem.

cne datafit

Conventional Neuroevolution weights in background.


Like the previous demo, the user can enter a series of points in the (X, Y) coordinate space, and the neural network will try to come up with a Y = f(X) function to fit the data, using CNE genetic algorithm method to find a set of weights for the neural network to generate fit the data.

Using the p5.js sketch code, I also output in greyscale what the neural network weights look like so it is interesting to see how it evolves over time.  Compared to the SGD examples, where the weight plane looks very smooth, these ones look rough and random in the end as expected.

SGD data fit

Stochastic Gradient Descent weights in background (for comparison purpose).


Try out the interactive CNE data fitting demo here.