Crates.io | flame-clustering |
lib.rs | flame-clustering |
version | 0.2.2 |
source | src |
created_at | 2023-02-14 15:07:33.169056 |
updated_at | 2023-06-19 19:19:58.37412 |
description | Fuzzy clustering by Local Approximation of MEmberships (FLAME) |
homepage | |
repository | https://github.com/TonyRippy/flame-clustering |
max_upload_size | |
id | 784970 |
size | 67,800 |
Fuzzy clustering by Local Approximation of MEmberships (FLAME) is a data clustering algorithm that defines clusters in the dense parts of a dataset and performs cluster assignment solely based on the neighborhood relationships among objects.
The algorithm was first described in: "FLAME, a novel fuzzy clustering method for the analysis of DNA microarray data", BMC Bioinformatics, 2007, 8:3. Available from: http://www.biomedcentral.com/1471-2105/8/3
This Rust library was adapted from the original C implementation.
The following is a simplified example of how one would use the library to cluster data:
use flame_clustering::DistanceGraph;
let data: Vec<f64> = vec![0.12, 0.23, 0.15, 0.19, 100.0];
let (clusters, outliers) = DistanceGraph::build(&data, |a, b| (a - b).abs())
.find_supporting_objects(2, -1.0)
.approximate_fuzzy_memberships(100, 1e-6)
.make_clusters(-1.0);
assert_eq!(format!("{clusters:?}"), "[[0, 1, 3, 2]]");
assert_eq!(format!("{outliers:?}"), "[4]");
The output is a sequence of indexes into the original dataset. In the example
above, one cluster was identified that contains the numbers
[0.12, 0.15, 0.19, 0.23]
, and 100.0
was identified as an outlier.
See the library documentation for more information about method parameters.
The Rust implementation differs from the original library in the following ways:
Flame
struct was replaced with a builder-style API. See library
documentation for details.assign_outliers()
method.Flame_DotProduct
and Flame_DotProductDist
distance methods, but I have not included them here.