mtopic.pl.select_n_topics#
- mtopic.pl.select_n_topics(mdata, *, plateau_threshold=0.05, figsize=(6, 5), transparent=False, save=None)#
Fit a rational function to the mean held-out log-likelihood curve and identify the optimal number of topics.
Requires
mtopic.tl.estimate_topic_numberto have been run first, which stores the CV results inmdata.uns["CV_results"].- Parameters:
mdata (muon.MuData) – MuData object containing
mdata.uns["CV_results"]frommtopic.tl.estimate_topic_number.plateau_threshold (float, optional) – Fraction of max slope used to define the plateau onset. Default is
0.05.figsize (tuple, optional) – Figure size in inches (width, height). Default is
(6, 5).transparent (bool, optional) – Whether to save the figure with a transparent background. Default is
False.save (str, optional) – Path to save the figure. If
None, the figure is shown but not saved. Default isNone.
- Returns:
None. Fit info is stored inmdata.uns["CV_fit_info"].- Return type:
None