jeffheaton / encog-java-core

http://www.heatonresearch.com/encog
Other
744 stars 268 forks source link

Online learning is missing a step? #179

Closed mowol closed 7 years ago

mowol commented 9 years ago

Hi, following http://www.heatonresearch.com/faq/5/3 there is something missing for the online learning.

Quoting from Littlestone, Nick; (1988) Learning Quickly When Irrelevant Attributes Abound: A New Linear-threshold Algorithm, Machine Learning: "More formally, an online algorithm proceeds in a sequence of trials. Each trial can be decomposed into three steps. First the algorithm receives an instance. Second the algorithm predicts the label of the instance. Third the algorithm receives the true label of the instance".

I think step 2 is missing, since the output from a sample is never received, and i can't figure out how to fetch it from the network. Furthermore the network actually runs over the several training set several times, until the achieved training error is below the given threshold.

The functionality of EncogUtility.trainToError() is really, really close to the training functionality of http://www.heatonresearch.com/wiki/Hello_World

What i want to do is to give the network/trainer a sample of input and ideal output. The network should then give me an output to the input sample, before training the network with that sample. The training should then only update its weight based on this single sample. It should then be up to the learning rate of backpropagation to remember old samples and learn new ones.

Using the XOR example, this would of course require the user to give the input samples several times before an acceptable network is created.

If you think i'm totally off, i'm interested in hearing about it, as well if you have other ideas, or if it possible to do what i want with the current code.

Thanks

/Morten

jeffheaton commented 7 years ago

Encog has been long overdue for a true online training ability. I have not used online training much, and this is the primary reason. See the below example, it has the requested steps. Training can occur element by element and updates to the weights requested as desired.

See Example Here