Giter Club home page Giter Club logo

Comments (5)

cazala avatar cazala commented on August 20, 2024

it seems that you are not passing any argument to .activate(input) that's why you get Cannot read property '0' of undefined on the line that reads F[1] = input[0];.

Can you provide the code you are using? How do you call the activate method?

from synaptic.

kaaninel avatar kaaninel commented on August 20, 2024

i check every input parameter on debugger and all of them was right.

RandomInputSet: (c,max) ->
for i in [0..c] by 1
q = Math.random() * max
@InputSet.push Converter.ToBinary q
Train: ->
while @CurrentIteration < @MaxIteration
q = Math.round Math.random() * @InputSet.length
@Network.activate @InputSet[q]
@Network.propagate @learningrate,@DesiredSet[q]
@CurrentIteration++
console.log @CurrentIteration

Example usage :

@net= new Network "net",8,8,8,8
@net.RandomInputSet 50,100
@net.Train();

from synaptic.

cazala avatar cazala commented on August 20, 2024

Okay, coffeescript is not my strong suit, but I ll do my best. First of all, this line:

@net= new Network "net",8,8,8,8`.

If that's synaptic.Network() then I believe you are providing wrong parameters to the constructor. The Network class expects to receive a layers object, containing an input and output layer, and an array of hidden layers. If what you are trying to do is a perceptron (one input layer with 8 neurons, one output layer with 8 neurons, and 2 hidden layers of 8 neurons each) then you should use the Architect.Perceptron class (see more)

Second thing, and what I believe is causing the undefined input, you are picking inputs from your input set using the following:

q = Math.round Math.random() * @InputSet.length
@Network.activate @InputSet[q] 

That will eventually return a q that's out of the bounds of the inputSet array, since you are using Math.round, instead of Math.floor. Lets say your input set has 50 inputs, then eventually Math.round(Math.random() * 50) will return a value of 50, that will make q be equal to 50 and that will make inputSet[q] be equal to undefined, and that's what causes the activate method to fail with that error.

Simple test:

a = 0;
while(Math.round(Math.random() * 50) != 50) a++;
console.log(a);

from synaptic.

kaaninel avatar kaaninel commented on August 20, 2024

Wow i have been fighting with this error for 2 days. I wont use replace all again :D
It wasn't synaptics network parameters seems right now thanks :) If this works it could be huge project and your project is core of it :D

from synaptic.

cazala avatar cazala commented on August 20, 2024

I'm glad i could help and that you find the library useful ^^ and I'm looking forward to see what you come up with!

from synaptic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.