-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathactivations.js
42 lines (40 loc) · 947 Bytes
/
activations.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(function() {
'use strict';
const sigmoid = require('./utils/sigmoid');
const sigmoidPrime = require('./utils/sigmoid-prime');
const softmax = require('./utils/softmax');
const activations = ['SIGMOID', 'SOFTMAX'];
module.exports = {
/**
* @description
* The sigmoid activation.
*/
SIGMOID: {
fn: sigmoid,
fnPrime: sigmoidPrime
},
SOFTMAX: {
fn: softmax
},
/**
* @description
* Return the list of supported activations
*
* @return {Array}
*/
activations: function() {
return activations;
},
/**
* @description
* Check if given activation is supported
*
* @param {String} activation The activation name (eg 'SIGMOID')
* @return {Boolean}
*/
isSupportedActivation: function(activation) {
activation = activation.toUpperCase();
return activations.includes(activation);
}
};
})();