anndict.wrappers.ai_determine_leiden_resolution_adata_dict#
- anndict.wrappers.ai_determine_leiden_resolution_adata_dict(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
AnnDataobject.- initial_resolution
float The initial resolution for Leiden clustering.
- adata
- Return type:
float- Returns:
The final
resolutionvalue after adjustments based on LLM interpretation.