pyntbci.stimulus.optimize_layout_incremental

pyntbci.stimulus.optimize_layout_incremental(X: NDArray, neighbours: NDArray, n_initializations: int = 100, n_iterations: int = 100, random_state: int | Generator = None) NDArray[source]

Optimize the allocation of codes to a layout by considering the correlation between neighboring codes. This method was developed and evaluated as part of [16].

Parameters:
  • X (NDArray) – Data matrix of shape (n_codes, n_samples).

  • neighbours (NDArray) – A matrix of neighbouring pairs of shape (n_neighbours, 2).

  • n_initializations (int (default: 100)) – The number of random initial layouts to test.

  • n_iterations (int (default: 100)) – The maximum number of iterations to improve a specific initial layout.

  • random_state (int | np.random.Generator (default: None)) – A seed or numpy random number generator to draw the random initial layouts from. If None, a new one is used.

Returns:

layout – The vector containing the mapping of codes to positions of shape (n_codes).

Return type:

NDArray

References