opendvp.tl.spatial_hyperparameter_search#
- spatial_hyperparameter_search(adata, x_y=None, threshold_range=None, return_df=False, plot_network_at=None)#
Perform a hyperparameter search over a range of threshold values.
To determine the number of connected nodes and average neighbors for different threshold values, and optionally plot the network of connected nodes at a given threshold.
- Parameters:
adata (anndata.AnnData) – Spatially indexed data.
x_y (list of str, default ['x_centroid', 'y_centroid']) – Column names in adata.obs representing the spatial coordinates.
threshold_range (numpy.ndarray, default np.arange(1, 100, 1)) – Range of threshold values to test.
return_df (bool, default False) – If True, return the DataFrame with threshold statistics along with the plot.
plot_network_at (Optional[int], default None) – The threshold value at which to plot the network of connected nodes. If None, no plot is generated.
- Returns:
If
return_dfis True, a tuple of the threshold-statisticsDataFrameand the(figure, axes)pair. Otherwise, only the(figure, axes)pair.- Return type: