12 Commits

Autor SHA1 Mensagem Data
Vsevolod Rodionov 0b31eed0d1 Update README.md 2016-09-20 14:16:38 +03:00
Juan Cazala a5fbefea5a Replace juancazala.com with caza.la 2016-09-16 19:42:46 -03:00
Vsevolod Rodionov 3d8265d804 version bump for CDNJS - no actual changes
see https://github.com/cazala/synaptic/issues/137
2016-09-13 12:14:35 +03:00
Vsevolod Rodionov 34c93cb718 Bringing synaptic.min.js and webpack.config that is outputting 100% identical .js and .min.js files - just a dirty fix for CDNJS
that is related to https://github.com/cazala/synaptic/issues/137, we're using fn.toString() and bunch of regex-es to create a worker for now (I know, it's bad, still we already have a fix, but it is breaking some of our actually-interal, but overly-exposed APIs, so it goes to v2), and we need to either have one version minified by us or it will be minified by CDNs.
2016-09-12 01:36:48 +03:00
Juan Cazala d3e2ea8488 Merge pull request #133 from bobalazek/master
Rate error bugfix
2016-08-19 18:17:12 -03:00
Borut 4cfd5a828f Rate error bugfix 2016-08-19 22:05:07 +02:00
Juan Cazala 24807634e8 Added slack badge 2016-08-19 12:12:56 -03:00
Juan Cazala ebac6d8c33 Merge pull request #121 from Jabher/karma_tests
bringing karma for browser testing
2016-08-03 11:26:45 -03:00
Juan Cazala b0a9559beb Merge pull request #120 from filet-mign0n/testreadme
replaced gulp with mocha in test readme
2016-07-29 17:29:12 -03:00
Vsevolod Rodionov 5a6c487102 bringing karma for browser testing 2016-07-29 15:47:27 +03:00
Filet Mig0n 9a06d558aa replaced gulp with mocha 2016-07-26 16:51:31 -07:00
Juan Cazala 0a544dbc9e Replaced pre-commit with pre-push 2016-07-26 11:06:49 -03:00
13 arquivos alterados com 2945 adições e 54 exclusões
+1
Ver Arquivo
@@ -1,4 +1,5 @@
language: node_js
script: "npm run test:travis"
node_js:
# always latest release
- "node"
+9 -7
Ver Arquivo
@@ -1,6 +1,8 @@
Synaptic [![Build Status](https://travis-ci.org/cazala/synaptic.svg?branch=master)](https://travis-ci.org/cazala/synaptic)
Synaptic [![Build Status](https://travis-ci.org/cazala/synaptic.svg?branch=master)](https://travis-ci.org/cazala/synaptic) [![Join the chat at https://synapticjs.slack.com](https://synaptic-slack-ugiqacqvmd.now.sh/badge.svg)](https://synaptic-slack-ugiqacqvmd.now.sh/)
========
## Important: [Synaptic 2.x](https://github.com/cazala/synaptic/issues/140) is in stage of discussion now! Feel free to participate
Synaptic is a javascript neural network library for **node.js** and the **browser**, its generalized algorithm is architecture-free, so you can build and train basically any type of first order or even [second order neural network](http://en.wikipedia.org/wiki/Recurrent_neural_network#Second_Order_Recurrent_Neural_Network) architectures.
This library includes a few built-in architectures like [multilayer perceptrons](http://en.wikipedia.org/wiki/Multilayer_perceptron), [multilayer long-short term memory](http://en.wikipedia.org/wiki/Long_short_term_memory) networks (LSTM), [liquid state machines](http://en.wikipedia.org/wiki/Liquid_state_machine) or [Hopfield](http://en.wikipedia.org/wiki/Hopfield_network) networks, and a trainer capable of training any given network, which includes built-in training tasks/tests like solving an XOR, completing a Distracted Sequence Recall task or an [Embedded Reber Grammar](http://www.willamette.edu/~gorr/classes/cs449/reber.html) test, so you can easily test and compare the performance of different architectures.
@@ -24,12 +26,12 @@ You may also want to take a look at [this article](http://blog.webkid.io/neural-
####Demos
- [Solve an XOR](http://synaptic.juancazala.com/#/xor)
- [Discrete Sequence Recall Task](http://synaptic.juancazala.com/#/dsr)
- [Learn Image Filters](http://synaptic.juancazala.com/#/image-filters)
- [Paint an Image](http://synaptic.juancazala.com/#/paint-an-image)
- [Self Organizing Map](http://synaptic.juancazala.com/#/self-organizing-map)
- [Read from Wikipedia](http://synaptic.juancazala.com/#/wikipedia)
- [Solve an XOR](http://caza.la/synaptic/#/xor)
- [Discrete Sequence Recall Task](http://caza.la/synaptic/#/dsr)
- [Learn Image Filters](http://caza.la/synaptic/#/image-filters)
- [Paint an Image](http://caza.la/synaptic/#/paint-an-image)
- [Self Organizing Map](http://caza.la/synaptic/#/self-organizing-map)
- [Read from Wikipedia](http://caza.la/synaptic/#/wikipedia)
The source code of these demos can be found in [this branch](https://github.com/cazala/synaptic/tree/gh-pages/scripts).
+27 -32
Ver Arquivo
@@ -91,21 +91,14 @@
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var Synaptic = {
Neuron: __webpack_require__(2),
Layer: __webpack_require__(4),
Network: __webpack_require__(5),
Trainer: __webpack_require__(6),
Architect: __webpack_require__(7)
Neuron: __webpack_require__(1),
Layer: __webpack_require__(3),
Network: __webpack_require__(4),
Trainer: __webpack_require__(5),
Architect: __webpack_require__(6)
};
// CommonJS & AMD
@@ -136,7 +129,7 @@
/***/ },
/* 2 */
/* 1 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {// export
@@ -936,10 +929,10 @@
}
})();
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)(module)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)(module)))
/***/ },
/* 3 */
/* 2 */
/***/ function(module, exports) {
module.exports = function(module) {
@@ -955,15 +948,15 @@
/***/ },
/* 4 */
/* 3 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {// export
if (module) module.exports = Layer;
// import
var Neuron = __webpack_require__(2)
, Network = __webpack_require__(5)
var Neuron = __webpack_require__(1)
, Network = __webpack_require__(4)
/*******************************************************************************************
LAYER
@@ -1235,19 +1228,19 @@
}
})();
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)(module)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)(module)))
/***/ },
/* 5 */
/* 4 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {// export
if (module) module.exports = Network;
// import
var Neuron = __webpack_require__(2)
, Layer = __webpack_require__(4)
, Trainer = __webpack_require__(6)
var Neuron = __webpack_require__(1)
, Layer = __webpack_require__(3)
, Trainer = __webpack_require__(5)
/*******************************************************************************************
NETWORK
@@ -1887,10 +1880,10 @@
return new Network(layers);
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)(module)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)(module)))
/***/ },
/* 6 */
/* 5 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {// export
@@ -1969,6 +1962,7 @@
testSet = set.slice(numTrain);
}
var lastError = 0;
while ((!abort && iterations < this.iterations && error > this.error)) {
if (crossValidate && error <= this.crossValidate.testError) {
break;
@@ -1984,7 +1978,7 @@
}
if(typeof this.rate === 'function') {
currentRate = this.rate(iterations, error);
currentRate = this.rate(iterations, lastError);
}
if (crossValidate) {
@@ -1998,6 +1992,7 @@
// check error
error /= currentSetSize;
lastError = error;
if (options) {
if (this.schedule && this.schedule.every && iterations %
@@ -2568,16 +2563,16 @@
}
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)(module)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)(module)))
/***/ },
/* 7 */
/* 6 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {// import
var Layer = __webpack_require__(4)
, Network = __webpack_require__(5)
, Trainer = __webpack_require__(6)
var Layer = __webpack_require__(3)
, Network = __webpack_require__(4)
, Trainer = __webpack_require__(5)
/*******************************************************************************************
ARCHITECT
@@ -2847,7 +2842,7 @@
// export
if (module) module.exports = Architect;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)(module)))
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)(module)))
/***/ }
/******/ ]);
+2848
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+25
Ver Arquivo
@@ -0,0 +1,25 @@
// Karma configuration
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
'dist/synaptic.js',
'test/[^_]*.js'
],
exclude: [
],
preprocessors: {
'test/*.js': ['webpack'],
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
singleRun: false,
concurrency: Infinity,
browserNoActivityTimeout: 60000,
})
}
+18 -5
Ver Arquivo
@@ -1,22 +1,35 @@
{
"name": "synaptic",
"version": "1.0.8",
"version": "1.0.9",
"description": "architecture-free neural network library",
"main": "./src/synaptic",
"scripts": {
"test": "mocha test",
"test": "npm run test:src",
"test:src": "mocha test --require src/synaptic.js ./test",
"test:dist": "npm run build && npm run test:mocha:dist && npm run test:karma:browsers",
"test:mocha:src": "mocha test --require src/synaptic.js ./test",
"test:mocha:dist": "mocha test --require dist/synaptic.js ./test",
"test:karma:browsers": "karma start --single-run --browsers Chrome,Firefox,SafariPrivate",
"test:karma:phantomjs": "karma start --single-run --browsers PhantomJS",
"test:travis": "npm run test:mocha:src && npm run build && npm run test:mocha:dist",
"build": "webpack --config webpack.config.js"
},
"precommit": [
"prepush": [
"test",
"build"
],
"devDependencies": {
"chai": "^3.5.0",
"chai-stats": "^0.3.0",
"karma": "^1.1.2",
"karma-chrome-launcher": "^1.0.1",
"karma-firefox-launcher": "^1.0.0",
"karma-mocha": "^1.1.1",
"karma-phantomjs-launcher": "^1.0.1",
"karma-safari-launcher": "^1.0.0",
"karma-webpack": "^1.7.0",
"mocha": "^2.2.4",
"pre-commit": "^1.1.3",
"random-js": "^1.0.8",
"pre-push": "^0.1.1",
"webpack": "^1.13.1"
},
"repository": {
+3 -1
Ver Arquivo
@@ -74,6 +74,7 @@ Trainer.prototype = {
testSet = set.slice(numTrain);
}
var lastError = 0;
while ((!abort && iterations < this.iterations && error > this.error)) {
if (crossValidate && error <= this.crossValidate.testError) {
break;
@@ -89,7 +90,7 @@ Trainer.prototype = {
}
if(typeof this.rate === 'function') {
currentRate = this.rate(iterations, error);
currentRate = this.rate(iterations, lastError);
}
if (crossValidate) {
@@ -103,6 +104,7 @@ Trainer.prototype = {
// check error
error /= currentSetSize;
lastError = error;
if (options) {
if (this.schedule && this.schedule.every && iterations %
+2 -2
Ver Arquivo
@@ -1,6 +1,6 @@
Test using gulp, from root directory:
Test using mocha, from root directory:
`gulp test`
`mocha test`
To test the web version, start a web server at the root dir of this repo, then use your OS browser.
+1
Ver Arquivo
@@ -0,0 +1 @@
global.synaptic = require('../dist/synaptic');
+1
Ver Arquivo
@@ -0,0 +1 @@
global.synaptic = require('../src/synaptic');
+1
Ver Arquivo
@@ -0,0 +1 @@
[^_]*.js
+4 -3
Ver Arquivo
@@ -3,8 +3,6 @@ var chai = require('chai');
chai.use(require('chai-stats'));
var assert = chai.assert;
var synaptic = require('../src/synaptic');
var Perceptron = synaptic.Architect.Perceptron;
var LSTM = synaptic.Architect.LSTM;
var Layer = synaptic.Layer;
@@ -425,6 +423,7 @@ describe("Optimized and Unoptimized Networks Equivalency", function () {
it('should produce the same output for both networks', function () {
this.timeout(30000);
for (var i = 0; i < 1000; i++) {
var input = generateRandomArray(2);
var target = generateRandomArray(1);
@@ -434,7 +433,7 @@ describe("Optimized and Unoptimized Networks Equivalency", function () {
unoptimized.propagate(learningRate, target);
}
var mse = calculateMse(optimized.activate(input), unoptimized.activate(input));
assert.isAtMost(mse, 1e-10, 'output should be same for both networks after ' + i + ' iterations');
assert.isAtMost(mse, 1e-9, 'output should be same for both networks after ' + i + ' iterations');
});
});
@@ -447,6 +446,7 @@ describe("toJSON/fromJSON Networks Equivalency", function () {
});
it('should produce the same output for both networks', function () {
this.timeout(30000);
for (var i = 0; i < 1000; i++) {
var input = generateRandomArray(10);
var output1 = original.activate(input);
@@ -473,6 +473,7 @@ describe("Cloned Networks Equivalency", function () {
});
it('should produce the same output for both networks', function () {
this.timeout(30000);
for (var i = 0; i < 1000; i++) {
var input = generateRandomArray(10);
var output1 = original.activate(input);
+5 -4
Ver Arquivo
@@ -2,12 +2,13 @@ var webpack = require('webpack')
var license = require('./prebuild.js')
module.exports = {
context: __dirname,
entry: [
'./src/synaptic.js'
],
entry: {
synaptic: './src/synaptic.js',
'synaptic.min': './src/synaptic.js'
},
output: {
path: 'dist',
filename: 'synaptic.js',
filename: '[name].js',
},
plugins: [
new webpack.NoErrorsPlugin(),