Spaces:
Sleeping
Sleeping
File size: 483 Bytes
932b3cb 3cab2dd 932b3cb 3cab2dd 04b61ad c2687ce 04b61ad c2687ce 04b61ad c2687ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import numpy as np
from cluster.clusterer import Clusterer
# for determing which clustering funciton to call
from cluster.opts import clustering_methods
def main(
X: np.array,
y: np.array,
args: dict,
) -> dict:
cluster_func = args.pop("algorithm")
cluster_alg: Clusterer = clustering_methods[cluster_func]
cluster_args: dict = {"cluster_func": cluster_func} | args
alg = cluster_alg.from_dict(cluster_args)
alg.build(X)
return alg.to_dict()
|