Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('loadings should be orthogonal', function () {
let m = pca
.getLoadings()
.transpose()
.mmul(pca.getLoadings())
.round();
expect(m.sub(Matrix.eye(4, 4)).sum()).toStrictEqual(0);
});
this.alpha = outputs.alpha;
this.inputs = outputs.inputs;
this.kernelType = outputs.kernelType;
this.kernelOptions = outputs.kernelOptions;
this.kernel = new Kernel(outputs.kernelType, outputs.kernelOptions);
} else {
inputs = Matrix.checkMatrix(inputs);
options = Object.assign({}, defaultOptions, options);
const kernelFunction = new Kernel(
options.kernelType,
options.kernelOptions
);
const K = kernelFunction.compute(inputs);
const n = inputs.rows;
K.add(Matrix.eye(n, n).mul(options.lambda));
this.alpha = solve(K, outputs);
this.inputs = inputs;
this.kernelType = options.kernelType;
this.kernelOptions = options.kernelOptions;
this.kernel = kernelFunction;
}
}