Skip to content

Commit

Permalink
Update tests and documentation
Browse files Browse the repository at this point in the history
Update tests and documentation to reflect recent change from `Autoencoder.includesAnomalies` to `Autoencoder.likelyIncludesAnomalies` as the method makes no API guarantee to detect anomalies with 100% accuracy
  • Loading branch information
voidvoxel committed Jun 19, 2024
1 parent cd0ad75 commit 693bd0b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ const data = net.denoise(noisyData);
Test for anomalies in data samples:

```javascript
const shouldBeFalse = net.includesAnomalies([0, 1, 1]);
const shouldBeTrue = net.includesAnomalies([0, 1, 0]);
const shouldBeFalse = net.likelyIncludesAnomalies([0, 1, 1]);
const shouldBeTrue = net.likelyIncludesAnomalies([0, 1, 0]);
```

### Training Options
Expand Down
10 changes: 5 additions & 5 deletions src/autoencoder-gpu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ test('encode and decode a data sample', async () => {
test('test a data sample for anomalies', async () => {
expect(result.error).toBeLessThanOrEqual(errorThresh);

function includesAnomalies(...args: number[]) {
function likelyIncludesAnomalies(...args: number[]) {
expect(xornet.likelyIncludesAnomalies(args, 0.5)).toBe(false);
}

includesAnomalies(0, 0, 0);
includesAnomalies(0, 1, 1);
includesAnomalies(1, 0, 1);
includesAnomalies(1, 1, 0);
likelyIncludesAnomalies(0, 0, 0);
likelyIncludesAnomalies(0, 1, 1);
likelyIncludesAnomalies(1, 0, 1);
likelyIncludesAnomalies(1, 1, 0);
});
10 changes: 5 additions & 5 deletions src/autoencoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ test('encode and decode a data sample', async () => {
test('test a data sample for anomalies', async () => {
expect(result.error).toBeLessThanOrEqual(errorThresh);

function includesAnomalies(...args: number[]) {
function likelyIncludesAnomalies(...args: number[]) {
expect(xornet.likelyIncludesAnomalies(args, 0.5)).toBe(false);
}

includesAnomalies(0, 0, 0);
includesAnomalies(0, 1, 1);
includesAnomalies(1, 0, 1);
includesAnomalies(1, 1, 0);
likelyIncludesAnomalies(0, 0, 0);
likelyIncludesAnomalies(0, 1, 1);
likelyIncludesAnomalies(1, 0, 1);
likelyIncludesAnomalies(1, 1, 0);
});

0 comments on commit 693bd0b

Please sign in to comment.