Contribution to Encog

Snuk the Great's picture

I have made a few patches for Encog that we use to analyse data and I would like to contribute them to the Encog project.

One patch is used generate a graph that will show how accurate a Neural Network is. What you do is:

  1. Create and train a network like you would usually do.
  2. Create a second 'Training Data' object with more data that was not used in the training.
  3. Click Tools > Validation Chart...
  4. Select the Neural Network and the second dataset.
  5. Click oke

This will create a window with a graph for every ideal with the validation data from the 'Training Data' object and what the neural network's result is. Check this image for more info. You can also look at the data in a table.

Patch

The second patch is to make pasting from Excel into 'Training Data' objects possible (in windows). A colleague mathematician had sheets in Excel and wanted to paste the sheets. I started from some example code, so credits for this patch should go there. It is also noted that this does not work on a Mac, probably because the copy paste keycombos are different.

It will only work if the pasted data does not have to much columns.

Patch

Patches are done on the source folder of the java project (trunk/encog-workbench/src) on revision 900

I also found a couple of frustrating bugs in encog you might want to check out. I submitted these to the Encog Google Code page.

I tried to keep myself to your code style. Tell me what you think.

jeffheaton's picture

Your patches sound very useful, especially from looking at the screen shot. I will include them both in Encog 2.2, which will be released in a month or so.

I will look at the bugs you mentioned as well. We will be doing a "bugfix" release in a week or so. So I will try to get them resolved for that.

Thank you very much for the very useful patches and information.

SeemaSingh's picture

I just checked in a fix. I believe it takes care of both bugs. I checked it into the branch too, so when you do the 2.1.1 build, it will have the bug fix. The extra rows were sneaking in because the persistor was not noticing the end of the XML and reading into the next record. You can grab it from the build server if you want.

SeemaSingh's picture

I also added the two patches, since you said you wanted them anyhow. They look good! Nice aditions to the workbench.

jeffheaton's picture

This bug affects .Net as well, I will propagate your change to that platform. Thanks for looking into the bug and applying the patches. The new chart type is cool!

Snuk the Great's picture

Thank you for the interest. I found out that both bugs I mentioned still persist in rev 906 (the newest as of now). So I think you might want to have another look at it.

I also found out that the patches did not get applied completely correctly. When pasting data that spans beyond the input columns, an error will occur. To fix this remove lines 221 and 222 from 'models/TrainingSetTableMod'.

Remove the bold lines:

for (final NeuralDataPair pair : this.data) {
    if (rowIndex == 0) {
        if (columnIndex >= pair.getInput().size()) {
            pair.getIdeal().setData(
                    columnIndex - pair.getInput().size(),
                    ((Double) value).doubleValue());
        } else {
            pair.getInput().setData(columnIndex,
                ((Double) value).doubleValue());
        }
        pair.getInput().setData(columnIndex,
                ((Double) value).doubleValue());

    }
    rowIndex--;
}

Once again, thanks for the interest from both me and my colleague.

edit
I expected this to be added at the bottom. Sorry if this is inconvenient.

Snuk the Great's picture

The bug fix for bug 27 actually did work. I just did not update the jars. So my bad there.

jeffheaton's picture

I just tested it myself and could not reproduce it. So that is good, it seems to be fixed. I also made the change on the patch you suggested. I didn't test it yet because I am not on a computer that has MS-Excel at the moment.

Thanks for the bug reports, and let us know if you happen to notice anything else.

I also added you and a link to your site to the contributors list for the workbench.

Thanks for the additions!


Copyright 2005 - 2012 by Heaton Research, Inc.. Heaton Research™ and Encog™ are trademarks of Heaton Research. Click here for copyright, license and trademark information.