wgauss_n_filtered_points#

crispy.scms.wgauss_n_filtered_points(X, G, h, weights, f_h=5)[source]#

Compute weighted Gaussian values for data points relative to walker positions, filtering out distant points to optimize computation.

This function calculates the Gaussian weights for data points (X) centered at walker positions (G) using a Gaussian kernel with bandwidth h. Data points farther than f_h * h from all walkers are excluded to reduce computational cost.

Parameters:
  • X (ndarray) – Coordinates of the data points, shape (n, D, 1), where n is the number of points and D is the dimensionality.

  • G (ndarray) – Coordinates of the walkers, shape (m, D, 1), where m is the number of walkers.

  • h (float) – Smoothing bandwidth of the Gaussian kernel.

  • weights (ndarray) – Weights of the data points, shape (n,).

  • f_h (float, optional, default=5) – Distance multiplier cutoff for filtering points. Data points farther than f_h * h from all walkers are excluded.

Returns:

  • X_filtered (ndarray) – Filtered coordinates of the data points, shape (k, D, 1), where k is the number of points that passed the filtering.

  • c (ndarray) – Weighted Gaussian values for each data point, shape (k,).

  • weights_filtered (ndarray) – Filtered weights corresponding to X_filtered, shape (k,).

  • dist (ndarray) – Distances between remaining data points and walker positions, shape (m, k).

Notes

  • The filtering step significantly reduces the number of data points to consider, which improves the efficiency of subsequent calculations.

Examples

Filter and compute Gaussian weights for a dataset:

>>> import numpy as np
>>> from crispy import scms
>>> data = np.random.random((100, 3, 1))  # 3D data points
>>> walkers = np.random.random((10, 3, 1))  # 3D walker positions
>>> weights = np.ones(100)  # Equal weights for data points
>>> X_filtered, c, weights_filtered, dist = scms.wgauss_n_filtered_points(data, walkers, h=0.5, weights=weights)