Skip to content

Commit 166c0f5

Browse files
Merge pull request #133 from BrainJS/v1.0.3-prep
V1.0.3 prep
2 parents c58765c + 872a7d2 commit 166c0f5

25 files changed

+299
-110
lines changed

ISSUE_TEMPLATE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!-- If you don't mind add a fun gif or meme, but no pressure -->
2+
![A GIF or MEME to give some spice of the internet](url)
3+
4+
## *What* is wrong?
5+
<!-- Ex. training network takes really long -->
6+
7+
## *Where* does it happen?
8+
<!-- Ex. In the a NeuralNetwork when trying to run a net in node.js on my mac -->
9+
10+
## *How* do we replicate the issue?
11+
<!-- Please be specific as possible. Use dashes (-) or numbers (1.) to create a list of steps -->
12+
13+
## *How* important is this (1-5)?
14+
<!-- On a scale from 1-5 where 5 is the most important how would you rate it? -->
15+
16+
## Expected behavior (i.e. solution)
17+
<!-- What do you think should have happened? -->
18+
19+
20+
## Other Comments

PULL_REQUEST_TEMPLATE.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!--- Provide a general summary of your changes in the Title above -->
2+
3+
<!-- If you don't mind add a fun gif or meme, but no pressure -->
4+
![A GIF or MEME to give some spice of the internet](url)
5+
6+
## Description
7+
<!--- Describe your changes in detail -->
8+
9+
## Motivation and Context
10+
<!--- Why is this change required? What problem does it solve? -->
11+
<!--- If it fixes an open issue, please link to the issue here. -->
12+
[issue](https://github.com/BrainJS/brain.js/issues/###)
13+
14+
## How Has This Been Tested?
15+
<!--- Please describe in detail how you tested your changes. -->
16+
<!--- Include details of your testing environment, tests ran to see how -->
17+
<!--- your change affects other areas of the code, etc. -->
18+
19+
## Screenshots (if appropriate):
20+
21+
## Types of changes
22+
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
23+
- [ ] Bug fix (non-breaking change which fixes an issue)
24+
- [ ] New feature (non-breaking change which adds functionality)
25+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
26+
27+
## Author's Checklist:
28+
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
29+
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
30+
- [ ] My code focuses on the main motivation and avoids scope creep.
31+
- [ ] My code passes current tests and adds new tests where possible.
32+
- [ ] My code is [SOLID](https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)) and [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself).
33+
- [ ] I have updated the documentation as needed.
34+
35+
## Reviewer's Checklist:
36+
- [ ] I kept my comments to the author positive, specific, and productive.
37+
- [ ] I tested the code and didn't find any new problems.
38+
- [ ] I think the motivation is good for the project.
39+
- [ ] I think the code works to satisfies the motivation.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,9 @@ Likely example see: [simple letter detection](./examples/which-letter-simple.js)
246246
Different neural nets do different things well. For example:
247247
* A Feedforward Neural Network can classify simple things very well, but it has no memory of previous actions and has infinite variation of results.
248248
* A Recurrent Neural Network _remembers_, and has a finite set of results.
249+
250+
# Get Involved!
251+
### Issues
252+
If you have an issue, either a bug or a feature you think would benefit your project let us know and we will do our best.
253+
254+
Create issues [here](https://github.com/BrainJS/brain.js/issues) and follow the template.

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "brain.js",
3-
"homepage": "https://github.com/harthur-org/brain.js",
3+
"homepage": "https://github.com/brainjs/brain.js",
44
"authors": [
55
"Heather Arthur <[email protected]>"
66
],
@@ -31,5 +31,5 @@
3131
"node_modules",
3232
"test"
3333
],
34-
"version": "1.0.0-rc.5"
34+
"version": "1.0.3"
3535
}

browser.js

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* license: MIT (http://opensource.org/licenses/MIT)
77
* author: Heather Arthur <[email protected]>
88
* homepage: https://github.com/brainjs/brain.js#readme
9-
* version: 1.0.2
9+
* version: 1.0.3
1010
*
1111
* acorn:
1212
* license: MIT (http://opensource.org/licenses/MIT)
@@ -1581,12 +1581,12 @@ var NeuralNetwork = function () {
15811581
} else if (i === this.outputLayer && (!layer[0] || json.outputLookup)) {
15821582
this.outputLookup = _lookup2.default.lookupFromHash(layer);
15831583
}
1584-
if (layer > 0) {
1584+
if (i > 0) {
15851585
var nodes = Object.keys(layer);
15861586
this.sizes[i] = nodes.length;
15871587
for (var j in nodes) {
15881588
var node = nodes[j];
1589-
this.biases[i] = layer[node].bias;
1589+
this.biases[i][j] = layer[node].bias;
15901590
this.weights[i][j] = (0, _toArray2.default)(layer[node].weights);
15911591
}
15921592
}
@@ -2479,6 +2479,44 @@ var Matrix = function () {
24792479
weights: this.weights.slice(0)
24802480
};
24812481
}
2482+
}, {
2483+
key: 'weightsToArray',
2484+
value: function weightsToArray() {
2485+
var deltas = [];
2486+
var row = 0;
2487+
var column = 0;
2488+
for (var i = 0; i < this.weights.length; i++) {
2489+
if (column === 0) {
2490+
deltas.push([]);
2491+
}
2492+
deltas[row].push(this.weights[i]);
2493+
column++;
2494+
if (column >= this.columns) {
2495+
column = 0;
2496+
row++;
2497+
}
2498+
}
2499+
return deltas;
2500+
}
2501+
}, {
2502+
key: 'deltasToArray',
2503+
value: function deltasToArray() {
2504+
var deltas = [];
2505+
var row = 0;
2506+
var column = 0;
2507+
for (var i = 0; i < this.deltas.length; i++) {
2508+
if (column === 0) {
2509+
deltas.push([]);
2510+
}
2511+
deltas[row].push(this.deltas[i]);
2512+
column++;
2513+
if (column >= this.columns) {
2514+
column = 0;
2515+
row++;
2516+
}
2517+
}
2518+
return deltas;
2519+
}
24822520
}], [{
24832521
key: 'fromJSON',
24842522
value: function fromJSON(json) {
@@ -4356,7 +4394,7 @@ var _randomWeight2 = _interopRequireDefault(_randomWeight);
43564394
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43574395

43584396
function randos(size) {
4359-
var array = new Array(size);
4397+
var array = new Float32Array(size);
43604398
for (var i = 0; i < size; i++) {
43614399
array[i] = (0, _randomWeight2.default)();
43624400
}
@@ -4397,30 +4435,27 @@ exports.default = toArray;
43974435
* @returns {*}
43984436
*/
43994437
function toArray(values) {
4400-
values = values || [];
44014438
if (Array.isArray(values)) {
44024439
return values;
44034440
} else {
4404-
return Object.keys(values).map(function (key) {
4405-
return values[key];
4406-
});
4441+
var keys = Object.keys(values);
4442+
var result = new Float32Array(keys.length);
4443+
for (var i in keys) {
4444+
result[i] = values[keys[i]];
4445+
}
4446+
return result;
44074447
}
44084448
}
44094449

44104450
},{}],43:[function(require,module,exports){
4411-
'use strict';
4451+
"use strict";
44124452

44134453
Object.defineProperty(exports, "__esModule", {
44144454
value: true
44154455
});
44164456
exports.default = zeros;
44174457
function zeros(size) {
4418-
if (typeof Float32Array !== 'undefined') return new Float32Array(size);
4419-
var array = new Array(size);
4420-
for (var i = 0; i < size; i++) {
4421-
array[i] = 0;
4422-
}
4423-
return array;
4458+
return new Float32Array(size);
44244459
}
44254460

44264461
},{}],44:[function(require,module,exports){

browser.min.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/neural-network.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/neural-network.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/recurrent/matrix/index.js

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/recurrent/matrix/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)