The Scikit package doesn't seem to recognize the distance threshold parameter which I am trying to use instead of the n-clusters parameter because I don't know how many clusters I will end up with, it depends on the data.
I am wondering if this is because the distance_threshold parameter was rolled out relatively recently, but I import scikit at the top of the file so I don't see why this would be a problem. Everything works as long as I don't include this parameter.
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.cluster import AgglomerativeClustering
cluster = AgglomerativeClustering(affinity='euclidean', linkage='ward',
distance_threshold = 400.0) #the last bit here is the problem
cluster.fit_predict(Revs)
labels = np.array(cluster.labels_).tolist()
It should run the clustering, instead I get this error message:
**TypeError**: __init__() got an unexpected keyword argument 'distance_threshold'