tumourkit.classification.read_graph.GraphDataset
- class tumourkit.classification.read_graph.GraphDataset(node_dir: str, max_dist: float, max_degree: int, files: List[str] | None = None, transform: Callable[[ndarray], ndarray] | None = None, column_normalize: bool | None = False, row_normalize: bool | None = False, normalizers: Tuple[Any] | None = None, return_names: bool | None = False, is_inference: bool | None = False, remove_prior: bool | None = False, remove_morph: bool | None = False, enable_background: bool | None = False)
Bases:
DatasetTorch Dataset to load graphs from .nodes.csv files.
Generated graph is in DGL format, with node attributes in .ndata and edge attributes in .edata.
Graph edges are generated on the fly.
Methods
Creates edges between nearby nodes.
Returns a tuple with all the normalizers in the order they are used.
Fits normalizers for later use and also checks they contain transform method.
- static create_edges(xx: List[float], yy: List[float], max_degree: int, threshold: float) Tuple[List[int], List[int]]
Creates edges between nearby nodes.
xx: X coordinates of nodes. yy: Y coordinates of nodes. max_degree: Maximum degree for each node. threshold: Maximum distance to look at.
Returns source: List of source nodes id. dest: List of destination nodes id. distances: Distances between nodes in edges.
- get_normalizers() Tuple[Any]
Returns a tuple with all the normalizers in the order they are used.
- initialize_normalizers()
Fits normalizers for later use and also checks they contain transform method.