Skip to content

eles.fuzzyCMeans(options?)

eles.fuzzyCMeans — Collection > Algorithms > Clustering. Cytoscape.js signatures, parameters and return contract.

eles.fuzzyCMeans — Collection › Algorithms › Clustering

Preview · Collection › Algorithms › Clustering

Read in the complete API reference · All API members

// Fuzzy c-means clustering: each element gets a degree of membership in every cluster rather than one hard assignment
eles.fuzzyCMeans(options?: KClusteringOptions): AlgoRun<FuzzyCMeansResult>

Fuzzy c-means clustering: each element gets a degree of membership in every cluster rather than one hard assignment. Async, with the same executor contract as kMeans.

Parameters
NameDescription
options: KClusteringOptions?

as kMeans, plus the fuzziness exponent

Fields of options
NameDescription
k: number?
m: number?
sensitivityThreshold: number?
distance: DistanceMetric?
maxIterations: number?
attributes: KAttributeFn[]?
testMode: boolean?
testCentroids: number | FeatureCentroid[] | Collection[] | null?
executor: AlgoExecutor?

where the run executes; see AlgoExecutor (default 'auto')

Returns AlgoRun<FuzzyCMeansResult>

a promise of { clusters, degreeOfMembership } — with cancel() on it: a pending run rejects with CancelledError, a 'cpu' run has already completed

Example

const run = eles.fuzzyCMeans({ k: 2, attributes: [node => node.data('score')], executor: 'cpu' });
const result = await run;
console.log(result.clusters.reduce((sum, cluster) => sum + cluster.length, 0)); // 3

Example graph and handle setup

Throws

if executor is invalid; rejects if executor: 'gpu' is unavailable in this environment, or executor: 'workers' is given a custom distance function

Also spelled eles.fcm.