Crates.io | dendritic-clustering |
lib.rs | dendritic-clustering |
version | 1.5.0 |
source | src |
created_at | 2024-10-29 12:52:37.574506 |
updated_at | 2024-11-01 19:43:29.738137 |
description | Package for algorithms related to clustering |
homepage | |
repository | |
max_upload_size | |
id | 1426977 |
size | 26,244 |
This crate allows for clustering of data for unsupervised tasks. The bayes crate currently supports K means clustering. Code for the Hierarchical clustering module is there but does not work at the moment
The dendritic project is a toy machine learning library built for learning and research purposes. It is not advised by the maintainer to use this library as a production ready machine learning library. This is a project that is still very much a work in progress.
This is an example of using the K means clustering module
use dendritic_ndarray::ndarray::NDArray;
use dendritic_ndarray::ops::*;
use dendritic_clustering::k_means::*;
use dendritic_knn::distance::*;
use dendritic_datasets::iris::*;
fn main() {
// Load datasets from saved ndarray
let data_path = "../dendritic-datasets/data/iris.parquet";
let (x_train, y_train) = load_iris(data_path).unwrap();
// Iterations and K value for K means cluster
let iterations = 5;
let k_value = 3;
// Create instance of K means model
let mut clf = KMeans::new(
&x_train,
k_value,
iterations,
euclidean
).unwrap();
// Get centroids
let final_centroids = clf.fit();
let centroids_unique = final_centroids.unique();
}