Skip to content

Commit

Permalink
prepare for publish
Browse files Browse the repository at this point in the history
  • Loading branch information
vincerubinetti committed Mar 24, 2020
1 parent cc5b14c commit 51691f0
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 5,029 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/npm-publish.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
yarn.lock
yarn-error.log
12 changes: 12 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
};
21 changes: 18 additions & 3 deletions build/hclust.min.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.clusterData = exports.averageDistance = exports.euclideanDistance = void 0;

// get euclidean distance between two equal-dimension vectors
export const euclideanDistance = (a, b) => {
const euclideanDistance = (a, b) => {
const size = Math.min(a.length, b.length);
let sum = 0;

Expand All @@ -8,7 +15,10 @@ export const euclideanDistance = (a, b) => {
return Math.sqrt(sum);
}; // get average distance between sets of indexes, given distance matrix

export const averageDistance = (setA, setB, distances) => {

exports.euclideanDistance = euclideanDistance;

const averageDistance = (setA, setB, distances) => {
let distance = 0;

for (const a of setA) {
Expand All @@ -18,6 +28,9 @@ export const averageDistance = (setA, setB, distances) => {
return distance / setA.length / setB.length;
}; // update progress by calling user onProgress and postMessage for web workers


exports.averageDistance = averageDistance;

const updateProgress = (stepNumber, stepProgress, onProgress) => {
// currently only two distinct steps: computing distance matrix and clustering
const progress = stepNumber / 2 + stepProgress / 2; // if onProgress is defined and is a function, call onProgress
Expand All @@ -31,7 +44,7 @@ const updateProgress = (stepNumber, stepProgress, onProgress) => {
const logProgress = progress => console.log('Clustering: ', (progress * 100).toFixed(1) + '%'); // the main clustering function


export const clusterData = ({
const clusterData = ({
data = [],
key = '',
distance = euclideanDistance,
Expand Down Expand Up @@ -103,3 +116,5 @@ export const clusterData = ({
clustersGivenK: clustersGivenK
};
};

exports.clusterData = clusterData;
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.6",
"@babel/preset-env": "^7.8.6",
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"babel-jest": "^25.1.0",
"babel-preset-minify": "^0.5.1",
"eslint": "^6.8.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-html": "^6.0.0",
"jest": "^25.1.0"
},
"browserslist": "> 0.1%, not dead"
Expand Down
83 changes: 0 additions & 83 deletions test/performance.html

This file was deleted.

2 changes: 0 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { clusterData } from '../build/hclust.min.js';
import { minDistance } from '../build/hclust.min.js';
import { maxDistance } from '../build/hclust.min.js';
import hcluster from './chrispolis.hcluster.min.js';

import dataset1 from './dataset-1.json';
Expand Down
Loading

0 comments on commit 51691f0

Please sign in to comment.