kmeans error: __init__() got an unexpected keyword argument 'precompute_distances'
ostwaldj opened this issue · 3 comments
Created a new virtual env with only Texthero and its dependencies installed. A year or more ago it worked, but now when I try to run kmeans, e.g.
.pipe(hero.kmeans,n_clusters=5)
it errors:
init() got an unexpected keyword argument 'precompute_distances'
This happens with my own data and code, and also when I paste the BBCSport sample code in as well.
Same problem.
Seems like sklearn.cluster.KMeans dont use precompute_distances anymore
You can comment the lines "precompute_distances="auto"" and "#n_jobs=n_jobs," in representation.py and will work
def kmeans(
s: pd.Series,
n_clusters=5,
init="k-means++",
n_init=10,
max_iter=300,
tol=0.0001,
precompute_distances="auto",
verbose=0,
random_state=None,
copy_x=True,
n_jobs=-1,
algorithm="auto",
):
"""
Perform K-means clustering algorithm.
"""
vectors = list(s)
kmeans = KMeans(
n_clusters=n_clusters,
init=init,
n_init=n_init,
max_iter=max_iter,
tol=tol,
#precompute_distances=precompute_distances,
verbose=verbose,
random_state=random_state,
copy_x=copy_x,
#n_jobs=n_jobs,
algorithm=algorithm,
).fit(vectors)
return pd.Series(kmeans.predict(vectors), index=s.index)
it's still present. when could it be re-evaluated?
Thanks for letting me know. I will look into that in the next few days and release a new version to fix that issue.