summaryrefslogtreecommitdiff
path: root/test/unit_tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit_tests')
-rw-r--r--test/unit_tests/activationFunctions.test.js30
-rw-r--r--test/unit_tests/binaryConverter.test.js36
-rw-r--r--test/unit_tests/layer.test.js26
-rw-r--r--test/unit_tests/nnetwork.test.js32
4 files changed, 62 insertions, 62 deletions
diff --git a/test/unit_tests/activationFunctions.test.js b/test/unit_tests/activationFunctions.test.js
index ed39405..4b68deb 100644
--- a/test/unit_tests/activationFunctions.test.js
+++ b/test/unit_tests/activationFunctions.test.js
@@ -3,21 +3,21 @@ const math = require('mathjs');
describe('Test Activation Function module', () => {
- let result;
- let testVector = [-2, -1, 0, 1, 2];
- testVector = math.matrix(testVector);
- let testMatrix = math.matrix([testVector, testVector]);
-
- result = activationFunctionList['sigmoid'].gx(testVector);
- result = activationFunctionList['sigmoid'].dg_dx(testVector);
-
- result = activationFunctionList['relu'].gx(testMatrix);
- result = activationFunctionList['relu'].dg_dx(testMatrix);
-
- result = activationFunctionList['identity'].gx(testMatrix);
- result = activationFunctionList['identity'].dg_dx(testMatrix);
-
- test.todo('Activation Function Tests');
+ let result;
+ let testVector = [-2, -1, 0, 1, 2];
+ testVector = math.matrix(testVector);
+ let testMatrix = math.matrix([testVector, testVector]);
+
+ result = activationFunctionList['sigmoid'].gx(testVector);
+ result = activationFunctionList['sigmoid'].dg_dx(testVector);
+
+ result = activationFunctionList['relu'].gx(testMatrix);
+ result = activationFunctionList['relu'].dg_dx(testMatrix);
+
+ result = activationFunctionList['identity'].gx(testMatrix);
+ result = activationFunctionList['identity'].dg_dx(testMatrix);
+
+ test.todo('Activation Function Tests');
});
diff --git a/test/unit_tests/binaryConverter.test.js b/test/unit_tests/binaryConverter.test.js
index b6fb503..109dee1 100644
--- a/test/unit_tests/binaryConverter.test.js
+++ b/test/unit_tests/binaryConverter.test.js
@@ -4,29 +4,29 @@ const math = require('mathjs');
//import BinaryConverter from 'binaryConverter';
describe('Test BinaryConversion module', () => {
-
- let testConverter;
- let testVector;
- let testInteger;
+
+ let testConverter;
+ let testVector;
+ let testInteger;
- beforeEach(() => {
- testConverter = new BinaryConverter(2);
- testInteger = 2;
- testVector = math.matrix([1, 0]);
- });
+ beforeEach(() => {
+ testConverter = new BinaryConverter(2);
+ testInteger = 2;
+ testVector = math.matrix([1, 0]);
+ });
- test('convert integer to binary array', () => {
- testConverter.integer = testInteger;
- expect(testConverter.inputActivation).toEqual(testVector);
- });
+ test('convert integer to binary array', () => {
+ testConverter.integer = testInteger;
+ expect(testConverter.inputActivation).toEqual(testVector);
+ });
- test('convert binary array to integer', () => {
- testConverter.inputActivation = testVector;
- expect(testConverter.integer).toEqual(testInteger);
- });
+ test('convert binary array to integer', () => {
+ testConverter.inputActivation = testVector;
+ expect(testConverter.integer).toEqual(testInteger);
+ });
- test.todo('Random array initializes correct integer');
+ test.todo('Random array initializes correct integer');
});
diff --git a/test/unit_tests/layer.test.js b/test/unit_tests/layer.test.js
index d7dcdb8..c570ceb 100644
--- a/test/unit_tests/layer.test.js
+++ b/test/unit_tests/layer.test.js
@@ -4,19 +4,19 @@ const math = require('mathjs');
describe('Test Layer module', () => {
- let testLayer = new Layer(2, 3, 'relu');
- let testConv = new BinaryConverter(2);
-
- testConv.randomInput()
- testLayer.forwardPropogation(testConv.inputActivation);
-
- testLayer = new Layer(2, 3, 'sigmoid');
- testLayer.forwardPropogation(testConv.inputActivation);
-
- testLayer = new Layer(2, 3, 'identity');
- testLayer.forwardPropogation(testConv.inputActivation);
-
- test.todo('Layer Tests');
+ let testLayer = new Layer(2, 3, 'relu');
+ let testConv = new BinaryConverter(2);
+
+ testConv.randomInput()
+ testLayer.forwardPropogation(testConv.inputActivation);
+
+ testLayer = new Layer(2, 3, 'sigmoid');
+ testLayer.forwardPropogation(testConv.inputActivation);
+
+ testLayer = new Layer(2, 3, 'identity');
+ testLayer.forwardPropogation(testConv.inputActivation);
+
+ test.todo('Layer Tests');
});
diff --git a/test/unit_tests/nnetwork.test.js b/test/unit_tests/nnetwork.test.js
index d7d9348..d09a0d7 100644
--- a/test/unit_tests/nnetwork.test.js
+++ b/test/unit_tests/nnetwork.test.js
@@ -4,23 +4,23 @@ const math = require('mathjs');
describe('Test NNetwork module', () => {
- // let testConv = new BinaryConverter(2);
- // let nodeCounts = [testConv._inputDigits, 3, testConv._outputDigits];
- // let afns = ['identity', 'relu', 'identity'];
-
- // let testNNetwork = new NNetwork(nodeCounts, afns, 0.1);
-
- // testConv.randomInput();
- // testNNetwork.forwardPropogation(testConv.inputActivation);
- // testNNetwork.backPropogation(testConv.inputActivation, testConv.outputActivation);
-
- // testConv.randomInput();
- // testNNetwork.forwardPropogation(testConv.inputActivation);
- // testNNetwork.backPropogation(testConv.inputActivation, testConv.outputActivation);
-
- // testNNetwork.gradientDescent();
+ // let testConv = new BinaryConverter(2);
+ // let nodeCounts = [testConv._inputDigits, 3, testConv._outputDigits];
+ // let afns = ['identity', 'relu', 'identity'];
+
+ // let testNNetwork = new NNetwork(nodeCounts, afns, 0.1);
+
+ // testConv.randomInput();
+ // testNNetwork.forwardPropogation(testConv.inputActivation);
+ // testNNetwork.backPropogation(testConv.inputActivation, testConv.outputActivation);
+
+ // testConv.randomInput();
+ // testNNetwork.forwardPropogation(testConv.inputActivation);
+ // testNNetwork.backPropogation(testConv.inputActivation, testConv.outputActivation);
+
+ // testNNetwork.gradientDescent();
- test.todo('NNetwork Tests');
+ test.todo('NNetwork Tests');
});