opendvp.tl.spatial_hyperparameter_search#
- opendvp.tl.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#
- adataAnnData
Spatially indexed data.
- x_ylist of str, default [‘x_centroid’, ‘y_centroid’]
Column names in adata.obs representing the spatial coordinates.
- threshold_rangenp.ndarray, default np.arange(1, 100, 1)
Range of threshold values to test.
- return_dfbool, default False
If True, return the DataFrame with threshold statistics along with the plot.
- plot_network_atOptional[int], default None
The threshold value at which to plot the network of connected nodes. If None, no plot is generated.
Returns:#
- If return_df is True:
- tuple[pandas.DataFrame, tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]]
DataFrame with threshold statistics and the plot (figure, axes).
- Else:
- tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]
The plot (figure, axes).