brainmass.datasets.delayed_match_task#
- brainmass.datasets.delayed_match_task(n_samples=128, *, seq_len=10, n_symbols=4, seed=0)[source]#
Generate a synthetic delayed-match-to-sample task.
Each trial presents a cue symbol, a delay, and a probe symbol, all one-hot encoded over
n_symbolsalong the last axis. The binary target is1if the probe matches the cue and0otherwise. The data is fully synthetic (no bundled binary, no MNIST) and deterministic givenseed.- Parameters:
n_samples (
int) – Number of trials. Default128.seq_len (
int) – Length of each input sequence (must be at least 2). The cue is att=0and the probe att=seq_len-1; the steps in between are the (empty) delay. Default10.n_symbols (
int) – The one-hot symbol alphabet size (last-axis depth). Default4.seed (
int) – Seed for the deterministic generator. Default0.
- Return type:
Tuple[ndarray,ndarray]- Returns:
inputs (numpy.ndarray) –
(n_samples, seq_len, n_symbols)float one-hot input sequences.targets (numpy.ndarray) –
(n_samples,)int match labels in{0, 1}.
See also
load_datasetload_dataset('delayed_match_task')returns the default task.
Examples
>>> from brainmass import datasets >>> inputs, targets = datasets.delayed_match_task(n_samples=8, seq_len=6) >>> inputs.shape (8, 6, 4) >>> sorted(set(targets.tolist())) == [0, 1] or set(targets.tolist()) <= {0, 1} True