# \#clustering

**URL:** https://discourse.julialang.org/tag/clustering/357.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [\[ANN\] PortfolioOptimisers.jl: Ape together strong](https://discourse.julialang.org/t/ann-portfoliooptimisers-jl-ape-together-strong/133099)

<div class="topic-metadata">

**Author:** [@dcelisgarza](https://discourse.julialang.org/u/dcelisgarza)\
**Replies:** 17\
**Last updated:** [September 27, 2026, 3:21pm UTC](https://discourse.julialang.org/t/ann-portfoliooptimisers-jl-ape-together-strong/133099 "2026-09-27T15:21:47Z")

</div>

PortfolioOptimisers.jl Editorial note: If you read this post and then go to the docs’ homepage or the package’s readme and they seem familiar, it’s because I started writing this before I had a proper readme. Portfolio …

---

## [New package for clustering - need for an arXiv endorser](https://discourse.julialang.org/t/new-package-for-clustering-need-for-an-arxiv-endorser/128983)

<div class="topic-metadata">

**Author:** [@uwestoehr](https://discourse.julialang.org/u/uwestoehr)\
**Replies:** 3\
**Last updated:** [April 13, 2026, 2:30pm UTC](https://discourse.julialang.org/t/new-package-for-clustering-need-for-an-arxiv-endorser/128983 "2026-04-13T14:30:42Z")

</div>

Hi I am Uwe, a MEMS engineer. During evaluation of some measurement data I had an idea for a clustering algorithm and started with Julia to be able to implement this algorithm as I had it in mind. That succeeded and the …

---

## [Pass Clustering.Hclust to Makie.dendrogram](https://discourse.julialang.org/t/pass-clustering-hclust-to-makie-dendrogram/135143)

<div class="topic-metadata">

**Author:** [@alequa](https://discourse.julialang.org/u/alequa)\
**Replies:** 4\
**Last updated:** [January 22, 2026, 5:34pm UTC](https://discourse.julialang.org/t/pass-clustering-hclust-to-makie-dendrogram/135143 "2026-01-22T17:34:14Z")

</div>

Hello, I would like to know how to convert the HClust object to a data format that can be processed by the dendrogram recipe for Makie. There is a quite long pull-request history for the dendrogram recipe, and it seems…

---

## [\[ANN\] UnsupervisedClustering.jl, a unified interface for clustering with optimization techniques](https://discourse.julialang.org/t/ann-unsupervisedclustering-jl-a-unified-interface-for-clustering-with-optimization-techniques/132720)

<div class="topic-metadata">

**Author:** [@raphasampaio](https://discourse.julialang.org/u/raphasampaio)\
**Replies:** 0\
**Last updated:** [September 27, 2025, 9:57pm UTC](https://discourse.julialang.org/t/ann-unsupervisedclustering-jl-a-unified-interface-for-clustering-with-optimization-techniques/132720 "2025-09-27T21:57:34Z")

</div>

I’m happy to announce UnsupervisedClustering.jl, a Julia package that provides a consistent interface for unsupervised clustering algorithms, along with strategies to escape local optima and reduce overfitting. Unsuperv…

---

## [Balanced clustering or assignment of 3D points in space](https://discourse.julialang.org/t/balanced-clustering-or-assignment-of-3d-points-in-space/121192)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 15\
**Last updated:** [October 27, 2024, 10:08am UTC](https://discourse.julialang.org/t/balanced-clustering-or-assignment-of-3d-points-in-space/121192 "2024-10-27T10:08:37Z")

</div>

I’m currently trying to solve the following problem Let P be a set of points in 3D space Split P into smaller sets of approximately equal size, the maximum size being a hard constraint Some properties about P P is g…

---

## [DBSCAN clustering with Haversine metric](https://discourse.julialang.org/t/dbscan-clustering-with-haversine-metric/121685)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 4\
**Last updated:** [October 24, 2024, 12:53pm UTC](https://discourse.julialang.org/t/dbscan-clustering-with-haversine-metric/121685 "2024-10-24T12:53:46Z")

</div>

Hi there, I have an array of points (latitude, longitude) in radians and I am trying to use the package Clustering.jl to cluster my points. In the documentation it seems like a metric can be given, the default being: Eu…

---

## [AssertionError in K-medoids algorithm](https://discourse.julialang.org/t/assertionerror-in-k-medoids-algorithm/116425)

<div class="topic-metadata">

**Author:** [@Hasselvej](https://discourse.julialang.org/u/Hasselvej)\
**Replies:** 0\
**Last updated:** [June 30, 2024, 12:12pm UTC](https://discourse.julialang.org/t/assertionerror-in-k-medoids-algorithm/116425 "2024-06-30T12:12:20Z")

</div>

I am using K-medoids to reduce my data (potential future scenarios of a stock’s price) from 400 scenarios to n = 25. I computed the distance matrix based on the Eucledian distance: C = pairwise(Euclidean(), data', data'…

---

## [Looking for Julia implementations of online clustering algorithms](https://discourse.julialang.org/t/looking-for-julia-implementations-of-online-clustering-algorithms/113649)

<div class="topic-metadata">

**Author:** [@vvbond](https://discourse.julialang.org/u/vvbond)\
**Replies:** 4\
**Last updated:** [May 1, 2024, 10:28am UTC](https://discourse.julialang.org/t/looking-for-julia-implementations-of-online-clustering-algorithms/113649 "2024-05-01T10:28:41Z")

</div>

… to no avail. The use case is quite common: real time clustering of streamed data. I envision a fusion between functionalities of the excellent OnlineStats.jl and Clustering.jl, but so far couldn’t find any ready imp…

---

## [RFC: ClusteringAPI.jl](https://discourse.julialang.org/t/rfc-clusteringapi-jl/112258)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 27\
**Last updated:** [April 18, 2024, 9:11pm UTC](https://discourse.julialang.org/t/rfc-clusteringapi-jl/112258 "2024-04-18T21:11:54Z")

</div>

Hi all, this could go either in statistics, data, or machine learning domains, please share. Alright, so I was trying to test various different clustering algorithms to see which one best clusters my data. In doing so,…

---

## [K-Medoids clustering in BetaML.jl](https://discourse.julialang.org/t/k-medoids-clustering-in-betaml-jl/91865)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 10\
**Last updated:** [December 20, 2022, 3:11pm UTC](https://discourse.julialang.org/t/k-medoids-clustering-in-betaml-jl/91865 "2022-12-20T15:11:31Z")

</div>

I am trying to use BetaML.jl package to cluster a set of data using K-Medoids algorithm; however, it seems to not classify the data into all classes. For example: using Random, BetaML X = rand(MersenneTwister(1234), 10…

---

## [K-Medoids clustering using BetaML.jl package](https://discourse.julialang.org/t/k-medoids-clustering-using-betaml-jl-package/91757)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 3\
**Last updated:** [December 18, 2022, 8:56pm UTC](https://discourse.julialang.org/t/k-medoids-clustering-using-betaml-jl-package/91757 "2022-12-18T20:56:11Z")

</div>

Why does K-Medoids algorithm not work using BetaML.jl package? For example (from docs), using BetaML X = \[1.1 10.1; 0.9 9.8; 10.0 1.1; 12.1 0.8; 0.8 9.8\] mod = KMedoidsClusterer(n\_classes=2) #Throws error: KMedoidsClu…

---

## [DimensionMismatch: The size of a distance matrix ((1, 440)) doesn't match the length of assignment vector (440)](https://discourse.julialang.org/t/dimensionmismatch-the-size-of-a-distance-matrix-1-440-doesnt-match-the-length-of-assignment-vector-440/90807)

<div class="topic-metadata">

**Author:** [@JUL1A](https://discourse.julialang.org/u/JUL1A)\
**Replies:** 3\
**Last updated:** [November 25, 2022, 3:36pm UTC](https://discourse.julialang.org/t/dimensionmismatch-the-size-of-a-distance-matrix-1-440-doesnt-match-the-length-of-assignment-vector-440/90807 "2022-11-25T15:36:13Z")

</div>

How to fix this: using Clustering using VectorizedStatistics function MyKmeans(Train::Vector{Float64}, k::Int64) the\_mat = Train' model = kmeans(the\_mat, k) return vmean(silhouettes(assignments(model), cou…

---

## [Get WCSS (Within-Cluster Sum of Square) for optimal number of clusters in kmeans](https://discourse.julialang.org/t/get-wcss-within-cluster-sum-of-square-for-optimal-number-of-clusters-in-kmeans/90374)

<div class="topic-metadata">

**Author:** [@indymnv](https://discourse.julialang.org/u/indymnv)\
**Replies:** 0\
**Last updated:** [November 16, 2022, 11:34pm UTC](https://discourse.julialang.org/t/get-wcss-within-cluster-sum-of-square-for-optimal-number-of-clusters-in-kmeans/90374 "2022-11-16T23:34:40Z")

</div>

I want to use kmeans for a clustering project, and I need to get the optimal number of clusters with the elbow method, is there a way to get the WCSS in the implementation of Clustering.jl to build something like this …

---

## [Silhouette coefficient calculation](https://discourse.julialang.org/t/silhouette-coefficient-calculation/89861)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 5\
**Last updated:** [November 7, 2022, 1:49pm UTC](https://discourse.julialang.org/t/silhouette-coefficient-calculation/89861 "2022-11-07T13:49:47Z")

</div>

I’ve written a Julia script to calculate the silhouette coefficient of the ClusterAnalysis.jl Kmeans’ result, but it’s highly inefficient and slow. I’ve written the procedure for both common and simplified versions of th…

---

## [How to seed the KMeans algorithm in Clustering.jl?](https://discourse.julialang.org/t/how-to-seed-the-kmeans-algorithm-in-clustering-jl/86288)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 3\
**Last updated:** [August 26, 2022, 6:58am UTC](https://discourse.julialang.org/t/how-to-seed-the-kmeans-algorithm-in-clustering-jl/86288 "2022-08-26T06:58:30Z")

</div>

How do I make sure I get the same clusters everytime I run the following code: using Clustering using Random # make a random dataset with 1000 random 5-dimensional points X = rand(MersenneTwister(10),5, 1000) # cluste…

---

## [Package for clustering data points](https://discourse.julialang.org/t/package-for-clustering-data-points/83154)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 8\
**Last updated:** [June 23, 2022, 5:22pm UTC](https://discourse.julialang.org/t/package-for-clustering-data-points/83154 "2022-06-23T17:22:55Z")

</div>

Any package recommendations for clustering data points? I see clustering.jl exist, however, I don’t see any recent activity on it. Is it still being maintained? Any other package that might be actively maintained?

---

## [Dbscan clustering with distance matrix](https://discourse.julialang.org/t/dbscan-clustering-with-distance-matrix/72700)

<div class="topic-metadata">

**Author:** [@frits45](https://discourse.julialang.org/u/frits45)\
**Replies:** 6\
**Last updated:** [December 7, 2021, 11:51am UTC](https://discourse.julialang.org/t/dbscan-clustering-with-distance-matrix/72700 "2021-12-07T11:51:37Z")

</div>

Hello, I need to cluster “objects” that are not points in space, but I can calculate a distance between them. The documentation says: There are two implementations of DBSCAN algorithm in this package (both provided by…

---

## [Parallel/distributed k-means clustering replicates](https://discourse.julialang.org/t/parallel-distributed-k-means-clustering-replicates/68963)

<div class="topic-metadata">

**Author:** [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Replies:** 1\
**Last updated:** [October 6, 2021, 3:34pm UTC](https://discourse.julialang.org/t/parallel-distributed-k-means-clustering-replicates/68963 "2021-10-06T15:34:20Z")

</div>

First time trying parallel processing; I’d like to run replicates for the kmeans algorithm in parallel to find a global minimum. Just calling kmeans on some data works fine: using Clustering n\_data\_points = 100000 dat…

---

## [Error using kmean clustering](https://discourse.julialang.org/t/error-using-kmean-clustering/64184)

<div class="topic-metadata">

**Author:** [@Nova](https://discourse.julialang.org/u/Nova)\
**Replies:** 6\
**Last updated:** [September 6, 2021, 5:59pm UTC](https://discourse.julialang.org/t/error-using-kmean-clustering/64184 "2021-09-06T17:59:58Z")

</div>

I am getting the following error when I try to use the kmean function: Julia version 1.5.3 All the packages are updated using Clustering using Distances using Statistics X = rand(5, 1000) R = kmeans(X, 20; maxiter=20…

---

## [Leiden algorithim implementation in Julia](https://discourse.julialang.org/t/leiden-algorithim-implementation-in-julia/55910)

<div class="topic-metadata">

**Author:** [@charperflow](https://discourse.julialang.org/u/charperflow)\
**Replies:** 5\
**Last updated:** [June 4, 2021, 5:31am UTC](https://discourse.julialang.org/t/leiden-algorithim-implementation-in-julia/55910 "2021-06-04T05:31:55Z")

</div>

I was wondering if anyone was aware of an implementation of the Leiden algorithm for Julia? It is a community detection algorithm which avoids the disconnected /poorly connected community problem associated with the louv…

---

## [\[ANN\] BijectiveHilbert.jl: Compute Hilbert curves in multiple dimensions](https://discourse.julialang.org/t/ann-bijectivehilbert-jl-compute-hilbert-curves-in-multiple-dimensions/56301)

<div class="topic-metadata">

**Author:** [@adolgert](https://discourse.julialang.org/u/adolgert)\
**Replies:** 0\
**Last updated:** [March 2, 2021, 5:17am UTC](https://discourse.julialang.org/t/ann-bijectivehilbert-jl-compute-hilbert-curves-in-multiple-dimensions/56301 "2021-03-02T05:17:23Z")

</div>

The Hilbert curve algorithm provides a simple way to cluster data for faster storage and retrieval. It’s used to distribute work among high-performance computers. There is a version of R-trees that uses Hilbert curves to…

---

## [Partitioning Around Medoids (PAM) in Julia](https://discourse.julialang.org/t/partitioning-around-medoids-pam-in-julia/50879)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 10\
**Last updated:** [November 30, 2020, 4:45pm UTC](https://discourse.julialang.org/t/partitioning-around-medoids-pam-in-julia/50879 "2020-11-30T16:45:20Z")

</div>

I’m unable to find any package that implements this algorithm. I’m going to attempt to implement the algorithm myself but I’m not sure if I have the know-how to get it over the finish line, to be perfectly honest. Would …

---

## [K-Medoids in Julia - Results Quality](https://discourse.julialang.org/t/k-medoids-in-julia-results-quality/50687)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 7\
**Last updated:** [November 27, 2020, 9:54pm UTC](https://discourse.julialang.org/t/k-medoids-in-julia-results-quality/50687 "2020-11-27T21:54:05Z")

</div>

I was reading the Wikipedia page on k-medoids clustering and in the Software section, it’s stated that: Julia contains a k-medoid implementation of the k-means style algorithm (faster, but much worse result quality) i…

---

## [Can be visualized clustering with the heatmap()?](https://discourse.julialang.org/t/can-be-visualized-clustering-with-the-heatmap/49903)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 8\
**Last updated:** [November 15, 2020, 2:48pm UTC](https://discourse.julialang.org/t/can-be-visualized-clustering-with-the-heatmap/49903 "2020-11-15T14:48:12Z")

</div>

With this code I get the desired heatmap. using Plots dataMatrix=rand(40,10) heatmap(dataMatrix,levels=10,colorbar=false) But I would like to achieve the image of the heatmap with cluster, as shown in the figure: H…

---

## [Deterministic Clustering in Julia?](https://discourse.julialang.org/t/deterministic-clustering-in-julia/42068)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 4\
**Last updated:** [June 26, 2020, 6:54am UTC](https://discourse.julialang.org/t/deterministic-clustering-in-julia/42068 "2020-06-26T06:54:41Z")

</div>

Are there any deterministic clustering methods implemented in Julia? For example: using Clustering using DataFrames df = DataFrame(subject=1:10, height=rand(10), weight=rand(10)) julia\> groups = kmeans(Matrix(df\[:, 2:…

---

## [Unexpected OutOfMemory error on HPC](https://discourse.julialang.org/t/unexpected-outofmemory-error-on-hpc/37190)

<div class="topic-metadata">

**Author:** [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)\
**Replies:** 17\
**Last updated:** [April 8, 2020, 2:43pm UTC](https://discourse.julialang.org/t/unexpected-outofmemory-error-on-hpc/37190 "2020-04-08T14:43:55Z")

</div>

Hello, I am using an HPC cluster to run a code that involves solving 2 huge sparse linear systems. I was able to test the code on my windows machine with 16GB memory. I used the macro @time to monitor the memory allocat…

---

## [Density-based clustering with incomplete distance matrix](https://discourse.julialang.org/t/density-based-clustering-with-incomplete-distance-matrix/35675)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 0\
**Last updated:** [March 7, 2020, 4:12am UTC](https://discourse.julialang.org/t/density-based-clustering-with-incomplete-distance-matrix/35675 "2020-03-07T04:12:26Z")

</div>

I am looking for a clustering algorithm (probably density based) that works with custom distances (I have my own non-Euclidean distance metric) and can work on very large datasets. I can evaluate nearest neighbors quickl…
