1 | 'use strict';
|
2 |
|
3 | var expect = require('chai').expect;
|
4 | var GaussianKernel = require('./gaussian.js');
|
5 |
|
6 | describe('Kernel.GaussianKernel', function () {
|
7 | describe('.apply', function () {
|
8 | it('should calculate the Gaussian kernel with variance 1 when called with default parameters', function () {
|
9 | expect(new GaussianKernel().apply([1, 2], [3, 4])).to.closeTo(0.01831563888, 1e-5);
|
10 | });
|
11 |
|
12 | it('should correctly calculate the Gaussian kernel with custom variance', function () {
|
13 | expect(new GaussianKernel(2).apply([1, 2], [3, 4])).to.closeTo(0.13533528323, 1e-5);
|
14 | });
|
15 |
|
16 | it('should return 1 when a point is compared to itself', function () {
|
17 | expect(new GaussianKernel().apply([1, 2], [1, 2])).to.closeTo(1, 1e-5);
|
18 | });
|
19 | });
|
20 | }); |
\ | No newline at end of file |