cazala / synaptic

architecture-free neural network library for node.js and the browser
http://caza.la/synaptic
Other
6.92k stars 666 forks source link

possible error in layer connection and ALL_TO_ELSE #340

Open iholgado opened 5 years ago

iholgado commented 5 years ago

Hi,

In Layer Connection, I don't undestant the line if(this.type == Layer.connectionType.ALL_TO_ELSE && from == to)

because from and to are Neuron objects in two differente layers. Maybe the code must be if(this.type == Layer.connectionType.ALL_TO_ELSE && here == there) ??

The original code was:

if (this.type == Layer.connectionType.ALL_TO_ALL ||
  this.type == Layer.connectionType.ALL_TO_ELSE) {
  for (var here in this.from.list) {
    for (var there in this.to.list) {
      var from = this.from.list[here];
      var to = this.to.list[there];
      if(this.type == Layer.connectionType.ALL_TO_ELSE && from == to)
        continue;
      var connection = from.project(to, weights);
      this.connections[connection.ID] = connection;
      this.size = this.list.push(connection);
    }
  }

Thanks,