parallelkdepy.core¶
Low-level plumbing: Manage Julia session and interfacing between Python and Julia.
Functions
|
|
|
Create a grid instance of the Julia object ParallelKDE.Grid. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creates a numpy array with the dirac sequence obtained from the data on the grid. |
- parallelkdepy.core.create_density_estimation(data: ndarray, grid, dims: Sequence | None = None, grid_bounds: Sequence[tuple] | None = None, grid_padding: Sequence | None = None, device: str = 'cpu')[source]¶
- parallelkdepy.core.create_grid(ranges: Sequence, device: str = 'cpu', b32: bool | None = None)[source]¶
Create a grid instance of the Julia object ParallelKDE.Grid.
- Parameters:
ranges (Sequence) – The ranges for the grid.
device (str, optional) – The device type, e.g., ‘cpu’ or ‘cuda’. Default is ‘cpu’.
b32 (Optional[bool], optional) – Whether to use 32-bit precision for GPU devices. Default is None, which behaves as True (32-bit precision) if the device is ‘cuda’. Setting it as False for ‘cuda’ devices will use 64-bit precision. This keyword argument is ignored when device is ‘cpu’.
- Returns:
The created grid object in Julia.
- Return type:
juliacall.AnyValue
- parallelkdepy.core.find_grid(data: ndarray, grid_bounds: Sequence[tuple] | None = None, grid_dims: Sequence | None = None, grid_steps: Sequence | None = None, grid_padding: Sequence | None = None, device: str = 'cpu')[source]¶
- parallelkdepy.core.initialize_dirac_sequence(data: ndarray, grid_jl=None, bootstrap_indices: ndarray | None = None, device: str = 'cpu', method: str | None = None) ndarray[source]¶
Creates a numpy array with the dirac sequence obtained from the data on the grid.
- Parameters:
data (np.ndarray) – Numpy array of the data with shape (n_samples, n_features).
grid_jl – Julia grid object.
bootstrap_indices (Optional[np.ndarray], optional) – Optional numpy array of bootstrap indices. If provided, it should have shape (n_bootstraps, n_samples).
device (str, optional) – The device to store the array, e.g., ‘cpu’ or ‘cuda’. Default is ‘cpu’.
method (str, optional) – The method to use for initializing the Dirac sequence, e.g., ‘serial’ or ‘parallel’. Default is ‘serial’.