# Clustering\_quality not defined

**URL:** https://discourse.julialang.org/t/clustering-quality-not-defined/114309
**Category:** General Usage
**Tags:** cluster
**Created:** [May 15, 2024, 4:52pm UTC](https://discourse.julialang.org/t/clustering-quality-not-defined/114309 "2024-05-15T16:52:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![GiuliaM](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giuliam/32/209287_2.png) [@GiuliaM](https://discourse.julialang.org/u/GiuliaM)
#### Post date: [May 15, 2024, 4:52pm UTC](https://discourse.julialang.org/t/clustering-quality-not-defined/114309/1 "2024-05-15T16:52:21Z")

</div>

Hello everyone! I’m trying to use the package Clustering.jl. The documentation reports this code to calculate different performance indices.

```julia
using Plots, Clustering
X = hcat([4., 5.] .+ 0.4 * randn(2, 10),
         [9., -5.] .+ 0.4 * randn(2, 5),
         [-4., -9.] .+ 1 * randn(2, 5))

nclusters = 2:5
clusterings = kmeans.(Ref(X), nclusters)

plot((
    plot(nclusters,
         clustering_quality.(Ref(X), clusterings, quality_index = qidx),
         marker = :circle,
         title = ":$qidx", label = nothing,
    ) for qidx in [:silhouettes, :calinski_harabasz, :xie_beni, :davies_bouldin, :dunn])...,
    layout = (3, 2),
    xaxis = "N clusters",
    plot_title = "\"Hard\" clustering quality indices"
)

```

when I try it, this error is displayed: “clustering\_quality is not defined”. Should I add something? Thank you very much.

![image](https://global.discourse-cdn.com/julialang/original/3X/3/e/3e0f31fe981cae27ca1a35c49ad7de4267bfeb3f.png)

---

<div class="post-metadata">

### Author: ![RobertGregg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robertgregg/32/22105_2.png) [@RobertGregg](https://discourse.julialang.org/u/RobertGregg)
#### Post date: [May 15, 2024, 5:47pm UTC](https://discourse.julialang.org/t/clustering-quality-not-defined/114309/2 "2024-05-15T17:47:11Z")

</div>

It looks like the `clustering_quality()` function is relatively new in Clustering.jl. Maybe check that you’re using the latest version (v0.15.7) ?
