KNN bandwidth# knn_bandwidth(x: ndarray, k: int | None = None) → float[source]# Compute the k-nearest neighbor bandwidth for a 1D array. Parameters: x (np.ndarray) – 1D array of data points k (Optional[int]) – number of nearest neighbors to consider. If k is None or less than 1, it will be set to the square root of the number of points. Returns: bandwidth value Return type: float