bioneuralnet.clustering.correlated_louvain

Functions

best_partition(graph[, partition, weight, ...])

Compute the partition of the graph nodes which maximises the modularity (or try..) using the Louvain heuristices

get_logger(name)

Retrieves a global logger configured to write to 'bioneuralnet.log' at the project root.

original_modularity(partition, graph[, weight])

Compute the modularity of a partition of a graph

pearsonr(x, y, *[, alternative, method])

Pearson correlation coefficient and p-value for testing non-correlation.

Classes

ASHAScheduler

alias of AsyncHyperBandScheduler

CLIReporter(*[, metric_columns, ...])

Command-line reporter

CorrelatedLouvain(G, B[, Y, k3, k4, weight, ...])

CorrelatedLouvain Class for Community Detection with Correlated Omics Data.

class bioneuralnet.clustering.correlated_louvain.CorrelatedLouvain(G: Graph, B: DataFrame, Y=None, k3: float = 0.2, k4: float = 0.8, weight: str = 'weight', tune: bool = False, gpu: bool = False, seed: int | None = None)[source]

Bases: object

CorrelatedLouvain Class for Community Detection with Correlated Omics Data. .. attribute:: G

NetworkX graph object.

type:

nx.Graph

B

Omics data.

Type:

pd.DataFrame

Y

Phenotype data.

Type:

pd.DataFrame

k3

Weight for Correlated Louvain.

Type:

float

k4

Weight for Correlated Louvain.

Type:

float

weight

Edge weight parameter name.

Type:

str

tune

Flag to enable tuning of parameters

Type:

bool

get_quality() float[source]
partition_to_adjacency(partition: dict) list[source]

Convert the partition dictionary into a list of adjacency matrices (DataFrames), where each adjacency matrix represents a cluster with more than 2 nodes.

run(as_dfs: bool = False) dict | list[source]

Run correlated Louvain clustering.

If as_dfs is True, returns a list of adjacency matrices (DataFrames), where each adjacency matrix represents a cluster with more than 2 nodes. Otherwise, returns the partition dictionary.

If tune is True and as_dfs is False, hyperparameter tuning is performed and the best parameters are returned. If tune is True and as_dfs is True, tuning is performed, and then standard detection is run using the tuned parameters.

run_tuning(num_samples=10)[source]