Package Exports
- @robzzson/silhouette
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@robzzson/silhouette) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Silhouette Coefficient
This is JavaScript implementation of Silhouette Coefficient used for the evaluation of clustering quality. The SC takes values from the interval [-1; 1]. The higher the SC the better clustering quality.
Installation
npm i @robzzson/silhouette
Example
const silhouette = require('@robzzson/silhouette');
const data = [
[-9.67867, -4.20271],
[0.08525, 3.64528],
[-7.38729, -8.53728],
[-5.93111, -9.25311],
[-8.5356, -6.01348],
[-2.18773, 3.33352],
[-0.79415, 2.10495],
];
const labels = [1, 0, 2, 2, 1, 0, 0];
let score = silhouette(data, labels);
console.log(score);