Search#
Direct Search phase of the Neighbourhood Algorithm as in Sambridge 1999(I). The Direct Search phase generates an approximation of the objective surface, finding models of acceptable data fit in a multidimensional parameter space in a derivative-free manner.
- class neighpy.search.NASearcher(objective: ObjectiveFunction, ns: int, nr: int, ni: int, n: int, bounds: Tuple[Tuple[float, float], ...], args: Tuple = (), seed: Optional[int] = None)#
- Parameters:
objective (Callable[[NDArray], float]) – The objective function to minimize. This function should take a single argument of type NDArray and return a float.
ns (int) – The number of samples generated at each iteration.
nr (int) – The number of cells to resample.
ni (int) – The number of samples from initial random search.
n (int) – The number of iterations.
bounds (Tuple[Tuple[float, float], ...]) – A tuple of tuples representing the bounds of the search space. Each inner tuple represents the lower and upper bounds for a specific dimension.
args (Tuple, optional) – Additional arguments to pass to the objective function.
seed (int, optional) – Seed for the random number generator.
- run(parallel=True) None#
Run the Direct Search.
Populates the following attributes:
samples (NDArray) - samples generated by the direct search.
objectives (NDArray) - objective function values for each sample.