Addition of Metric Calculation Methods #131
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Scarf Metrics
This PR introduces initial metric calculation functionalities for assessing cell population structures and integration quality in
DataStore
. Three new methods have been added to theDataStore
class:metric_lisi
: Computes the Local Inverse Simpson Index (LISI) scores to evaluate the mixing of cell populations across neighborhoods.metric_silhouette
: Calculates modified silhouette scores to assess cluster separation.metric_integration
: Measures alignment quality between batches using ARI or NMI.The file
metrics.py
was added to provide implementations for these metric functions.1.
metric_lisi()
This function calculates LISI scores for cell populations.
Key Parameters:
label_colnames
,use_latest_knn
,from_assay
.Return: Optionally returns LISI scores by label if return_lisi=True
2.
metric_silhouette()
:Computes silhouette scores, adapted for use with KNN graphs.
Key Parameters:
use_latest_knn
,res_label
.Return: Returns an array of silhouette scores for each cluster. NaN values indicate clusters that could not be scored.
3.
metric_integration()
:Calculates integration scores between batches using ARI or NMI.
Key Parameters:
batch_labels
,metric
(default:ari
).Return: Returns a float between
0
and1
, indicating alignment quality.Examples: