I have fitted a KMeans model and retrived the centroid for the data.
Is there any way that I can use the predict() function using these centroids to initalise the KMeans model but without calling the fit function
I tried to run the following code and ran into this error. Here the jsonl file has a json object as
{ "primary" : [[<some_array>]]}
{ "secondary" : [[<some_array>]]}
models = dict()
for json_str in json_list:
result = json.loads(json_str)
models[list(result.keys())[0]] = list(result.values())[0]
from sklearn.cluster import KMeans
k = KMeans(init = np.array(models['primary']))
k.predict(inference_data)
NotFittedError: This KMeans instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.
This problem is well handeled in cuml version of KMeans but how to get it done with sklearn.