3

According to http://scikit-learn.org/stable/modules/generated/sklearn.cluster.AgglomerativeClustering.html#sklearn.cluster.AgglomerativeClustering linkage types are : {“ward”, “complete”, “average”, “single”}, optional (default=”ward”).

But once I try to use single I obtain

Unknown linkage type single.Valid options are dict_keys(['ward', 'average', 'complete'].

Is it possible to set linkage to "single"? Scikit-learn version I use is 0.20.0.

Minimal not-working code:

from sklearn.cluster import AgglomerativeClustering
import numpy as np

X = np.array([[1, 2], [1, 4], [1, 0],
              [4, 2], [4, 4], [4, 0]])
clustering = AgglomerativeClustering( linkage='single').fit(X)
lexmar
  • 31
  • 3
  • 1
    What version of sklearn are you using? – Dani Mesejo Oct 23 '18 at 19:00
  • Questions seeking debugging help ("**why isn't this code working?**") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it **in the question itself**. Questions without a **clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – Joooeey Oct 23 '18 at 20:48
  • 1
    Are you sure you are using version 0.20.0? How are you checking the version and how are you running your code? – Vivek Kumar Oct 24 '18 at 07:35
  • 2
    I run 'pip install -U scikit-learn' and obtain "Requirement already up-to-date" – lexmar Oct 24 '18 at 09:09
  • I added minimal not-working code above – lexmar Oct 24 '18 at 09:15

1 Answers1

-2

If you are using jupter notebook, you can use this to update sklearn old sklearn version in Jupyter Notebook