Skip to content

Commit

Permalink
Manual cleanup of pca1d-test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
curran committed Jan 2, 2021
1 parent 3ece1ec commit b7f9917
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions test/pca1d-test.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
const reorder = require('../dist/reorder.cjs');

const vows = require('vows'),
assert = require('assert');
const vows = require('vows');
const assert = require('assert');

const suite = vows.describe('reorder.pca1d');

suite.addBatch({
pca1d: {
simple() {
const mat = [
[2.5, 2.4],
[0.5, 0.7],
[2.2, 2.9],
[1.9, 2.2],
[3.1, 3.0],
[2.3, 2.7],
[2.0, 1.6],
[1.0, 1.1],
[1.5, 1.6],
[1.1, 0.9],
],
pca = reorder.pca1d(mat);
[2.5, 2.4],
[0.5, 0.7],
[2.2, 2.9],
[1.9, 2.2],
[3.1, 3.0],
[2.3, 2.7],
[2.0, 1.6],
[1.0, 1.1],
[1.5, 1.6],
[1.1, 0.9],
];
const pca = reorder.pca1d(mat);

assert.inDeltaArray(pca, [0.67833, 0.734755], 0.001);

assert.deepEqual(reorder.sort_order(pca), [0, 1]);
},
lesssimple() {
const data = [
[80, 27, 89, 42],
[80, 27, 88, 37],
[75, 25, 90, 37],
[62, 24, 87, 28],
[62, 22, 87, 18],
[62, 23, 87, 18],
[62, 24, 93, 19],
[62, 24, 93, 20],
[58, 23, 87, 15],
[58, 18, 80, 14],
[58, 18, 89, 14],
[58, 17, 88, 13],
[58, 18, 82, 11],
[58, 19, 93, 12],
[50, 18, 89, 8],
[50, 18, 86, 7],
[50, 19, 72, 8],
[50, 19, 79, 8],
[50, 20, 80, 9],
[56, 20, 82, 15],
[70, 20, 91, 15],
],
pca = reorder.pca1d(data);
[80, 27, 89, 42],
[80, 27, 88, 37],
[75, 25, 90, 37],
[62, 24, 87, 28],
[62, 22, 87, 18],
[62, 23, 87, 18],
[62, 24, 93, 19],
[62, 24, 93, 20],
[58, 23, 87, 15],
[58, 18, 80, 14],
[58, 18, 89, 14],
[58, 17, 88, 13],
[58, 18, 82, 11],
[58, 19, 93, 12],
[50, 18, 89, 8],
[50, 18, 86, 7],
[50, 19, 72, 8],
[50, 19, 79, 8],
[50, 20, 80, 9],
[56, 20, 82, 15],
[70, 20, 91, 15],
];
const pca = reorder.pca1d(data);

assert.inDeltaArrayOrNeg(pca, [0.642, 0.195, 0.197, 0.715], 0.001);
assert.deepEqual(reorder.sort_order(pca), [1, 2, 0, 3]);
Expand Down

0 comments on commit b7f9917

Please sign in to comment.