summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/activationFunctions.js6
-rw-r--r--test/reports/coverage.txt13
-rw-r--r--test/unit_tests/activationFunctions.test.js38
3 files changed, 31 insertions, 26 deletions
diff --git a/src/activationFunctions.js b/src/activationFunctions.js
index 6ccc046..a5dedde 100644
--- a/src/activationFunctions.js
+++ b/src/activationFunctions.js
@@ -1,4 +1,4 @@
-console.log('Hello from activationFunctions.js');
+const math = require('mathjs');
let sigmoidExpression = '1 / (1 + exp(-x))';
let dSigmoidExpression = math.derivative(sigmoidExpression, 'x');
@@ -51,4 +51,6 @@ activationFunctionList = {
gx: matrixMethod(identity),
dg_dx: matrixMethod(dIdentity_dx)
}
-}; \ No newline at end of file
+};
+
+module.exports = activationFunctionList; \ No newline at end of file
diff --git a/test/reports/coverage.txt b/test/reports/coverage.txt
index a2ed4c1..dc96a2d 100644
--- a/test/reports/coverage.txt
+++ b/test/reports/coverage.txt
@@ -1,6 +1,7 @@
---------------------|---------|----------|---------|---------|-------------------
-File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------|---------|----------|---------|---------|-------------------
-All files | 83.78 | 100 | 70 | 86.11 |
- binaryConverter.js | 83.78 | 100 | 70 | 86.11 | 30-33,45
---------------------|---------|----------|---------|---------|-------------------
+------------------------|---------|----------|---------|---------|-------------------
+File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
+------------------------|---------|----------|---------|---------|-------------------
+All files | 90.32 | 100 | 84.21 | 91.66 |
+ activationFunctions.js | 100 | 100 | 100 | 100 |
+ binaryConverter.js | 83.78 | 100 | 70 | 86.11 | 30-33,45
+------------------------|---------|----------|---------|---------|-------------------
diff --git a/test/unit_tests/activationFunctions.test.js b/test/unit_tests/activationFunctions.test.js
index b7fd570..ed39405 100644
--- a/test/unit_tests/activationFunctions.test.js
+++ b/test/unit_tests/activationFunctions.test.js
@@ -1,23 +1,25 @@
-console.log('Hello from activationFunctions.test.js');
+const activationFunctionList = require('../../src/activationFunctions');
+const math = require('mathjs');
-console.log(activationFunctionList);
+describe('Test Activation Function module', () => {
-let result;
-let testVector = [-2, -1, 0, 1, 2];
-testVector = math.matrix(testVector);
-let testMatrix = math.matrix([testVector, testVector]);
+ 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');
+
+});
-result = activationFunctionList['sigmoid'].gx(testVector);
-console.log(result);
-result = activationFunctionList['sigmoid'].dg_dx(testVector);
-console.log(result);
-result = activationFunctionList['relu'].gx(testMatrix);
-console.log(result);
-result = activationFunctionList['relu'].dg_dx(testMatrix);
-console.log(result);
-result = activationFunctionList['identity'].gx(testMatrix);
-console.log(result);
-result = activationFunctionList['identity'].dg_dx(testMatrix);
-console.log(result);