File size: 505 Bytes
932b3cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from dataclasses import dataclass
from typing import Callable
import numpy as np


@dataclass
class Clusterer:
    cluster_func: Callable
    options: dict

    accuracy: float = 0

    @staticmethod
    def label():
        return

    def eval(y_pred, y_true) -> None:
        return

    @classmethod
    def from_dict(cls, dct):
        return cls(**dct)

    def to_dict(self):
        return {
            "cluster_method": self.cluster_func.__name__,
            "options": self.options,
        }