File size: 488 Bytes
932b3cb
 
3cab2dd
932b3cb
b378fde
932b3cb
 
 
 
 
f31d9cf
932b3cb
3cab2dd
f31d9cf
c2687ce
f31d9cf
ecb0c79
c2687ce
04b61ad
e571d8c
 
527f863
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import numpy as np

from cluster.clusterer import Clusterer
from cluster.opts import clustering_methods
from cluster.plot import plot


def main(
    X: np.array,
    y: np.array,
    clusterer: str,
    args: dict,
) -> dict:
    cluster_alg: Clusterer = clustering_methods[clusterer]

    args.update({"cluster_func": cluster_alg})
    alg = cluster_alg.from_dict(args)

    alg.build(X)
    plt_data = plot(clusterer=alg, X=X)
    alg.set_plot_data(plt_data)
    return alg.to_dict(X)