Source code for nachos.splitters.abstract_splitter

from abc import ABC, abstractmethod
from nachos.data.Data import Dataset, Split
from nachos.similarity_functions.SimilarityFunctions import SimilarityFunctions
from nachos.constraints.Constraints import Constraints
from typing import List


[docs]class AbstractSplitter(ABC):
[docs] @classmethod @abstractmethod def build(cls, conf: dict): pass
[docs] def __init__(self, sim_fn: SimilarityFunctions, constraint_fn: Constraints): self.sim_fn = sim_fn self.constraint_fn = constraint_fn
[docs] @abstractmethod def __call__(self, d: Dataset) -> List[Dataset]: pass
[docs] def score(self, u: Dataset, s: Split) -> float: return self.constraint_fn(u, s)