5 stable releases
1.5.0 | Nov 1, 2024 |
---|---|
1.4.0 | Nov 1, 2024 |
1.3.0 | Nov 1, 2024 |
1.2.0 | Nov 1, 2024 |
1.1.0 | Oct 29, 2024 |
#925 in Algorithms
16KB
250 lines
Dendritic Clustering Crate
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
Features
- K Means: Standard K means clustering
Disclaimer
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.
Example Usage
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();
}
Dependencies
~36MB
~715K SLoC