New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ahebrank/affinity-propagation

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ahebrank/affinity-propagation

Affinity propagation clustering (Frey & Dueck, Science 2007)

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

affinity-propagation

Affinity propagation is a clustering method developed by Brendan J. Frey and Delbert Dueck. This is a Javascript implementation based on and tested against their original Matlab implementation.

Frey & Dueck: Clustering by Passing Messages Between Data Points, Science 2007

Installation

affinity-propagation is available in npm:

$ npm install affinity-propagation

Usage

var apclust = require('affinity-propagation')

// input is a two-dimensional similarity matrix, doesn't have to be symmetric
var data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

// basic usage
var result = apclust.getClusters(data)
console.log(result)

// result.exemplars is an array of indices of data points that are cluster exemplars
// result.clusters is an array indicating which cluster each data point belongs to

// 'preference', 'damping', 'maxIter' and 'convIter' options are available
//
// 'preference' is the inital preference of each data point being a cluster exemplar
// it can be 'median' (data median, default), 'min' (data minimum), or any number
//
// 'damping' is the damping factor between iterations (default: 0.8)
//
// 'maxIter' is the maximum number of iterations to run
//
// 'convIter' is the number of iterations after which the clustering stops if it has converged
//
result = apclust.getClusters(data, {preference: 'min', damping: 0.6})
console.log(result)

Testing

$ npm install
$ npm test

Keywords

clustering

FAQs

Package last updated on 03 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts