From d8e17c036eecadb17c6521fac23a5d956b8fd415 Mon Sep 17 00:00:00 2001 From: Christian Hodgden Date: Fri, 9 Feb 2024 14:49:12 +0000 Subject: added module imports and describe() method to activationFunction testing --- test/reports/coverage.txt | 13 +++++----- test/unit_tests/activationFunctions.test.js | 38 +++++++++++++++-------------- 2 files changed, 27 insertions(+), 24 deletions(-) (limited to 'test') 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); -- cgit v1.2.3