Compocyte.core.hierarchical_classifierΒΆ
Hierarchical classifier implementation.
This module provides HierarchicalClassifier, a composite classifier that manages a hierarchy of local classifiers for annotating single-cell data. The class orchestrates feature selection, training and prediction across the hierarchy and provides save/load utilities.
- class Compocyte.core.hierarchical_classifier.HierarchicalClassifier(save_path, adata=None, root_node=None, dict_of_cell_relations=None, obs_names=None, default_input_data='normlog', num_threads=1, ignore_counts=False, temp_path=None)[source]ΒΆ
Bases:
DataBase,HierarchyBase,ExportImportBase- create_local_classifier(node: str, overwrite: bool = False, classifier_type: DenseTorch | LogisticRegression | BoostedTrees = <class 'Compocyte.core.models.dense_torch.DenseTorch'>, **classifier_kwargs)[source]ΒΆ
- introduce_limit(max_cells: int, stratify_by: str)[source]ΒΆ
Introduces a limit on the number of cells per local classifier training and specifies a stratification criterion.
Parameters: max_cells (int): The maximum number of cells allowed. stratify_by (str): The criterion by which to stratify the cells.
- predict_all_child_nodes(node: str, threshold: float = -1, mlnp: bool = False, monte_carlo: int = None)[source]ΒΆ
- predict_single_node(node: str, threshold: float = -1, monte_carlo: int = None) numpy.array[source]ΒΆ
- run_feature_selection(node: str, overwrite: bool = False, n_features: int = -1, max_features: int = None, min_features: int = 30, test_factor: float = 1.0, max_cells=100000)[source]ΒΆ