published by jfelrod1960 on Fri, 07/20/2012 - 08:25
Have anyone used Encog for Java and GWT (Google Web Toolkit)? If you have what issues if any have you experienced? If no one have used Encog in GWT then I can use this thread to report my use with it.
Some time has passed since I started this topic. Encog uses a lot of java classes and methods that is not understood by the JRE Emulation in GWT. I looked into just using Encog's source code and making an extension that would contain a subset of Encog's classes. If anyone has been successful in doing this I would appreciate your comments.
It is nice to read that someone would be interested in this sort of thing because I have spent a few days chasing this down.
The following link shows you the XORNEAT.java example running fully in JavaScript (also, it became GAE compatible in the process): http://encog-gwt.appspot.com
What I have now is a maimed version of Encog Core that can run (at least) XORNEAT compiled with GWT. My focus has been solely to see if it could work, and I chose an example that I was most interested in using if it did.
If you are interested in knowing if a specific example (still) works, tell me and I would be happy to find out.
This is the XORNEAT example rewritten for GWT (made recursive to print the epochs to screen as it goes): http://pastebin.com/0hpT9ySV
This list shows the kind of errors I encountered. This list was saved about 2/3 in the process so there were many more to fix: http://pastebin.com/zZmCzU4i
To get your own list of errors you should do the following:
1. Create a new GWT project.
2. Copy encog-core packages into the .shared package
3. Start the compiler with the -strict flag
The most errors came from Object.clone() not being supported. This was easily fixed in cases where it just wanted to copy a int[] or double[], but harder where it wanted to copy entire Networks using serialization. I had to disabled the latter function entirely but that did not break anything so far.
Other errors were about java.util.concurrency classes. Classes with this issue have been made mostly hollow. I imagine that WebWorkers could be used at some point so these classes may still come in handy.
StringTokenizer could not be used so those parts have been rewritten using String.split(). NumberFormat is unavailable so I've disabled it. Restoring the formatting using a custom helper is a //todo at this point.
Everything concerning storing files (e.g. the persistence classes) had to be disabled. I would like to restore this feature with a browser based approach.
Overal, the biggest damage I've done is deleting the encog.core.app and encog.core.bot packages entirely. I felt they would distract me from bringing the XORNEAT example online.
This is great ... there is a physics engine written in javascript that I'm playing around with. I want to use that to simulate a small mechanical device and use a neural controller to control it. I'm using JSNI to interface with the physics engine. Are you planning to do more with "gwtcog"?
Have never tried it, but I
Have never tried it, but I would be very curious to see what you come up with.
Some time has passed since I
Some time has passed since I started this topic. Encog uses a lot of java classes and methods that is not understood by the JRE Emulation in GWT. I looked into just using Encog's source code and making an extension that would contain a subset of Encog's classes. If anyone has been successful in doing this I would appreciate your comments.
Hi all,
Hi all,
It is nice to read that someone would be interested in this sort of thing because I have spent a few days chasing this down.
The following link shows you the XORNEAT.java example running fully in JavaScript (also, it became GAE compatible in the process):
http://encog-gwt.appspot.com
What I have now is a maimed version of Encog Core that can run (at least) XORNEAT compiled with GWT. My focus has been solely to see if it could work, and I chose an example that I was most interested in using if it did.
If you are interested in knowing if a specific example (still) works, tell me and I would be happy to find out.
Could you explain the changes
Could you explain the changes you had to make or provide a copy of the XORNEAT example?
This is the XORNEAT example
I will upload the code here: https://github.com/MichielVdAnker/gwtcog
This is the XORNEAT example rewritten for GWT (made recursive to print the epochs to screen as it goes):
http://pastebin.com/0hpT9ySV
This list shows the kind of errors I encountered. This list was saved about 2/3 in the process so there were many more to fix:
http://pastebin.com/zZmCzU4i
To get your own list of errors you should do the following:
1. Create a new GWT project.
2. Copy encog-core packages into the .shared package
3. Start the compiler with the -strict flag
The most errors came from Object.clone() not being supported. This was easily fixed in cases where it just wanted to copy a int[] or double[], but harder where it wanted to copy entire Networks using serialization. I had to disabled the latter function entirely but that did not break anything so far.
Other errors were about java.util.concurrency classes. Classes with this issue have been made mostly hollow. I imagine that WebWorkers could be used at some point so these classes may still come in handy.
StringTokenizer could not be used so those parts have been rewritten using String.split(). NumberFormat is unavailable so I've disabled it. Restoring the formatting using a custom helper is a //todo at this point.
Everything concerning storing files (e.g. the persistence classes) had to be disabled. I would like to restore this feature with a browser based approach.
Overal, the biggest damage I've done is deleting the encog.core.app and encog.core.bot packages entirely. I felt they would distract me from bringing the XORNEAT example online.
ActivationFunctions used to
ActivationFunctions used to be created using Reflection, so I created a static factory method that instantiates them from String.
This is great ... there is a
This is great ... there is a physics engine written in javascript that I'm playing around with. I want to use that to simulate a small mechanical device and use a neural controller to control it. I'm using JSNI to interface with the physics engine. Are you planning to do more with "gwtcog"?