Source code for immuneML.ml_methods.clustering.ClusteringMethod

import abc

from immuneML.data_model.datasets.Dataset import Dataset


[docs] class ClusteringMethod: """ Clustering methods are algorithms which can be used to cluster repertoires, receptors or sequences without using external label information (such as disease or antigen binding state) These methods can be used in the :ref:`Clustering` instruction. """ DOCS_TITLE = "Clustering methods" def __init__(self, name: str = None): self.name = name self.model = None
[docs] @abc.abstractmethod def fit(self, dataset: Dataset): pass
[docs] @abc.abstractmethod def predict(self, dataset: Dataset): pass
[docs] @abc.abstractmethod def fit_predict(self, dataset: Dataset): pass
[docs] @abc.abstractmethod def transform(self, dataset: Dataset): pass
[docs] def get_data_for_clustering(dataset: Dataset): if dataset.encoded_data.dimensionality_reduced_data is not None: return dataset.encoded_data.dimensionality_reduced_data else: return dataset.encoded_data.examples