anndict.annotate.ai_determine_leiden_resolution#
- anndict.annotate.ai_determine_leiden_resolution(adata, initial_resolution)[source]#
Adjusts the Leiden clustering resolution of an AnnData object based on LLM feedback.
This function iteratively performs Leiden clustering on the AnnData object, generates a UMAP plot, and uses an LLM model to interpret the plot and suggest whether to increase, decrease, or maintain the current resolution. The resolution is adjusted by ±0.1 based on the LLM’s suggestion until no further adjustment is needed.
- Parameters:
- adata
AnnData
An
AnnData
object.- initial_resolution
float
The initial resolution for Leiden clustering.
- adata
- Return type:
float
- Returns:
The final
resolution
value after adjustments based on LLM interpretation.