Created
August 12, 2019 15:44
-
-
Save luiscarbonell/9fa9cee439f41185dfb5dd52328f32c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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