Skip to content

Instantly share code, notes, and snippets.

@luiscarbonell
Created August 12, 2019 15:44
Show Gist options
  • Select an option

  • Save luiscarbonell/9fa9cee439f41185dfb5dd52328f32c1 to your computer and use it in GitHub Desktop.

Select an option

Save luiscarbonell/9fa9cee439f41185dfb5dd52328f32c1 to your computer and use it in GitHub Desktop.
const uid = require("cuid");
const Group = require("./group");
function Network(sizes, biases, weights) {
let self = this;
this.id = uid();
this.groups = sizes == undefined ? [] : sizes.map(function(size, index) {
if(biases == undefined) return new Group(size);
else return new Group(size, biases[index]);
});
this.groups.slice(0, this.groups.length - 1).forEach(function(group, index) {
if(weights) group.connect(self.groups[index + 1], weights[index]);
else group.connect(self.groups[index + 1]);
})
// Code here...
}
module.exports = Network;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment