# K-Medoids clustering using BetaML.jl package

**URL:** https://discourse.julialang.org/t/k-medoids-clustering-using-betaml-jl-package/91757
**Category:** Data
**Tags:** question, package, clustering
**Created:** [December 16, 2022, 9:21pm UTC](https://discourse.julialang.org/t/k-medoids-clustering-using-betaml-jl-package/91757 "2022-12-16T21:21:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![math\_opt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/math_opt/32/25317_2.png) [@math\_opt](https://discourse.julialang.org/u/math_opt)
#### Post date: [December 16, 2022, 9:21pm UTC](https://discourse.julialang.org/t/k-medoids-clustering-using-betaml-jl-package/91757/1 "2022-12-16T21:21:10Z")

</div>

Why does `K-Medoids` algorithm not work using `BetaML.jl` package? For example (from [docs](https://sylvaticus.github.io/BetaML.jl/stable/Clustering.html#BetaML.Clustering.KMedoidsClusterer)),

```julia
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: KMedoidsClusterer not defined

```

Am I using the wrong function? Thanks.

---

<div class="post-metadata">

### Author: ![liamfdoherty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liamfdoherty/32/24516_2.png) [@liamfdoherty](https://discourse.julialang.org/u/liamfdoherty)
#### Post date: [December 16, 2022, 10:44pm UTC](https://discourse.julialang.org/t/k-medoids-clustering-using-betaml-jl-package/91757/2 "2022-12-16T22:44:11Z")

</div>

This works for me. What is your package status? In case you haven’t done it before, you can get this with

```julia
] st

```

at the REPL. I have BetaML v0.9.5, so if yours is outdated it might not have this functionality.

---

<div class="post-metadata">

### Author: ![math\_opt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/math_opt/32/25317_2.png) [@math\_opt](https://discourse.julialang.org/u/math_opt)
#### Post date: [December 18, 2022, 8:47pm UTC](https://discourse.julialang.org/t/k-medoids-clustering-using-betaml-jl-package/91757/3 "2022-12-18T20:47:21Z")

</div>

Surprisingly, when I add the package to my global environment, it adds the `0.7.0` version. Not sure what’s the reason for this. Here is the list of packages I have installed. Can you point out if this is due to some dependency conflict?

```julia
  [2e2ca445] BARON v0.8.0
  [6e4b80f9] BenchmarkTools v1.3.1
  [024491cd] BetaML v0.7.0
  [485130c0] BilevelJuMP v0.5.1
  [6cde8614] BlockDecomposition v1.8.0
  [a076750e] CPLEX v0.9.3
  [336ed68f] CSV v0.10.4
  [13f3f980] CairoMakie v0.8.12
  [aaaa29a8] Clustering v0.14.2
  [5ae59095] Colors v0.12.8
  [88b4ec78] Coluna v0.4.1
  [a81c6b42] Compose v0.9.4
  [717857b8] DSP v0.7.7
  [a93c6f00] DataFrames v1.3.6
  [31c24e10] Distributions v0.25.53
  [191a621a] Dualization v0.5.4
  [e9467ef8] GLMakie v0.6.12
  [1ecd5474] GraphMakie v0.4.1
  [a2cc645c] GraphPlot v0.5.2
  [bd48cda9] GraphRecipes v0.5.9
  [86223c79] Graphs v1.5.2
  [2e9cd046] Gurobi v0.11.3
  [b6b21f68] Ipopt v1.0.2
  [4076af6c] JuMP v1.0.0
  [98e50ef6] JuliaFormatter v1.0.3
  [b964fa9f] LaTeXStrings v1.3.0
  [093fc24a] LightGraphs v1.3.5
  [a4795742] NLPModels v0.18.4
  [792afdf1] NLPModelsJuMP v0.10.1
  [14b8a8f1] PkgTemplates v0.7.26
  [91a5bcdd] Plots v1.27.6
  [014a38d5] QuadraticToBinary v0.4.0
  [ce6b1742] RDatasets v0.7.7
  [189a3867] Reexport v1.2.2
  [47aef6b3] SimpleWeightedGraphs v1.1.1
  [2913bbd2] StatsBase v0.33.16
  [fdbf4ff8] XLSX v0.8.4
  [37e2e46d] LinearAlgebra

```

Thanks.

---

<div class="post-metadata">

### Author: ![liamfdoherty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liamfdoherty/32/24516_2.png) [@liamfdoherty](https://discourse.julialang.org/u/liamfdoherty)
#### Post date: [December 18, 2022, 8:56pm UTC](https://discourse.julialang.org/t/k-medoids-clustering-using-betaml-jl-package/91757/4 "2022-12-18T20:56:11Z")

</div>

Try doing `] add BetaML@0.9.5`. This probably won’t get the issue fixed, but should give a message indicating the package(s) that may be blocking the update.

From there, you can remove the packages that are causing issues and try again. Usually this happens with old packages that are no longer maintained.
