src/estimagic/optimization/trust_region_sampling.py
def _get_empty_bin_info(existing_upscaled, n_points):
    """Find empty bins in space populated by existing points.

    Args:
        existing_upscaled (np.ndarray): Upscaled points.
        n_points (int): Number of points originally sampled.

    Returns:
        out (np.ndarray): Empty bins for each dimension. Has shape
            (len(existing_upscaled) - n_points, n_dim). Non-empty bins are marked by -1,
            and occur since not all dimensions must have the same number of empty bins.

    """
    n_dim = existing_upscaled.shape[1]
    empty_bins = []
    all_bins = set(range(n_points))

    for j in range(n_dim):
        filled_bins = set(np.floor(existing_upscaled[:, j].astype(int)))
        empty_bins.append(sorted(all_bins - filled_bins))

    max_empty = max(map(len, empty_bins))

    out = np.full((max_empty, n_dim), -1)
    for j, empty in enumerate(empty_bins):
        out[: len(empty), j] = empty

    return out
Find empty bins in space populated by existing points.

    Args:
        existing_upscaled (np.ndarray): Upscaled points.
        n_points (int): Number of points originally sampled.

    Returns:
        out (np.ndarray): Empty bins for each dimension. Has shape
            (len(existing_upscaled) - n_points, n_dim). Non-empty bins are marked by -1,
            and occur since not all dimensions must have the same number of empty bins.

    
Find empty bins in space populated by existing points.
Find empty bins in space populated by existing points .
def _get_empty_bin_info(existing_upscaled, n_points):
    n_dim = existing_upscaled.shape[1]
    empty_bins = []
    all_bins = set(range(n_points))
    for j in range(n_dim):
        filled_bins = set(np.floor(existing_upscaled[:, j].astype(int)))
        empty_bins.append(sorted(all_bins - filled_bins))
    max_empty = max(map(len, empty_bins))
    out = np.full((max_empty, n_dim), -1)
    for j, empty in enumerate(empty_bins):
        out[: len(empty), j] = empty
    return out
def _get_empty_bin_info ( existing_upscaled , n_points ) : n_dim = existing_upscaled . shape [ 1 ] empty_bins = [ ] all_bins = set ( range ( n_points ) ) for j in range ( n_dim ) : filled_bins = set ( np . floor ( existing_upscaled [ : , j ] . astype ( int ) ) ) empty_bins . append ( sorted ( all_bins - filled_bins ) ) max_empty = max ( map ( len , empty_bins ) ) out = np . full ( ( max_empty , n_dim ) , - 1 ) for j , empty in enumerate ( empty_bins ) : out [ : len ( empty ) , j ] = empty return out
Find empty bins in space populated by existing points.
Find empty bins in space populated by existing points .
"""Find empty bins in space populated by existing points.

    Args:
        existing_upscaled (np.ndarray): Upscaled points.
        n_points (int): Number of points originally sampled.

    Returns:
        out (np.ndarray): Empty bins for each dimension. Has shape
            (len(existing_upscaled) - n_points, n_dim). Non-empty bins are marked by -1,
            and occur since not all dimensions must have the same number of empty bins.

    """
out (np.ndarray): Empty bins for each dimension. Has shape
(len(existing_upscaled) - n_points, n_dim). Non-empty bins are marked by -1,
and occur since not all dimensions must have the same number of empty bins.
out ( np . ndarray ) : Empty bins for each dimension . Has shape ( len ( existing_upscaled ) - n_points n_dim ) . Non - empty bins are marked by - 1 and occur since not all dimensions must have the same number of empty bins .
existing_upscaled
None
n_points
Number of points originally sampled.
Number of points originally sampled .