Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var derFunction = params > 1 ? (val) => selectedFunction.derivate(val, options.activationParam) : selectedFunction.derivate;
this.activationFunction = function (i, j) {
this.set(i, j, actFunction(this.get(i, j)));
};
this.derivate = function (i, j) {
this.set(i, j, derFunction(this.get(i, j)));
};
if (options.model) {
// load model
this.W = Matrix.checkMatrix(options.W);
this.b = Matrix.checkMatrix(options.b);
} else {
// default constructor
this.W = Matrix.rand(this.inputSize, this.outputSize);
this.b = Matrix.zeros(1, this.outputSize);
this.W.apply(function (i, j) {
this.set(i, j, this.get(i, j) / Math.sqrt(options.inputSize));
});
}
}