eval
¶
evaluate
¶
evaluate(
metrics: Sequence[metrics_list],
y_true=None,
y_score=None,
y_pred=None,
adata: Optional[AnnData] = None,
batchid: Optional[str] = None,
typeid: Optional[str] = None,
emb: Optional[str] = None,
clustid: Optional[str] = None,
spaid: Optional[str] = None,
**kwargs
)
Evaluate performance metrics based on specified evaluation metrics. Different metrics require different parameters. Here is a description of the metrics that can be calculated and the parameters they require.
Functions:
Name | Description |
---|---|
AUC |
|
Precision |
|
Recall |
|
F1 |
|
F1*NMI |
|
SGD_degree |
|
SGD_cc |
|
ARI |
|
NMI |
|
ASW_type |
|
1-ASW_batch |
|
BatchKL |
|
iLISI |
|
cLISI |
|
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metrics |
Sequence[str]
|
List of evaluation metrics to compute. |
required |
y_true |
Optional[Union[Series, ndarray]]
|
True labels. |
None
|
y_score |
Optional[Union[Series, ndarray]]
|
Predicted scores or probabilities. |
None
|
y_pred |
Optional[Union[Series, ndarray]]
|
Predicted labels. |
None
|
adata |
Optional[AnnData]
|
Annotated data containing embeddings or clusters. |
None
|
batchid |
Optional[str]
|
Batch ID key in adata.obs for batch information. |
None
|
typeid |
Optional[str]
|
Type ID key in adata.obs for type information. |
None
|
emb |
Optional[str]
|
Key for embeddings in adata.obsm. |
None
|
clustid |
Optional[str]
|
Cluster ID key in adata.obs for clustering information. |
None
|
spaid |
Optional[str]
|
Spatial coordinates ID key in adata.obsm (for SGD_degree & SGD_cc metrics). |
None
|
Other Parameters:
Name | Type | Description |
---|---|---|
n_neighbors |
int
|
Number of neighbors for SGD KNN graph. |
bins |
int
|
Number of equal-width bins in the given range when calculating SGD_cc. |
num_bootstrap_samples |
int
|
Number of bootstrap samples for distribution estimation. |
sigma |
int
|
Sigma parameter for Gaussian Earth Mover's Distance. |
Returns:
Type | Description |
---|---|
Union[Tuple[float], float]
|
Depending on the number of specified metrics, returns a tuple of metric values or a single metric value. |
Raises:
Type | Description |
---|---|
RuntimeError
|
In the anomaly detection, it doesn't specify |
Note
SGD_degree & SGD_cc are available for both anomaly detection and subtyping tasks. They will automatically determine the category based on the types of anomalies in y_true eliminating the need for additional parameters to specify whether it is the subtyping task.
Source code in src\stands\evaluate\eval.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|