diff options
author | Christian Hodgden <chrhodgden@gmail.com> | 2024-02-09 14:49:12 +0000 |
---|---|---|
committer | Christian Hodgden <chrhodgden@gmail.com> | 2024-02-09 14:49:12 +0000 |
commit | d8e17c036eecadb17c6521fac23a5d956b8fd415 (patch) | |
tree | 1277e4753a78e7f96f2840e50ae3b91cd4068a52 /test | |
parent | 60e9f9e8a7df69aa94de0e9752a3faf3c0c62253 (diff) |
added module imports and describe() method to activationFunction testing
Diffstat (limited to 'test')
-rw-r--r-- | test/reports/coverage.txt | 13 | ||||
-rw-r--r-- | test/unit_tests/activationFunctions.test.js | 38 |
2 files changed, 27 insertions, 24 deletions
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); |