HierarchicalReasoning#
- class braintools.cogtask.HierarchicalReasoning(t_fixation=Quantity(500., 'ms'), t_flash1=Quantity(100., 'ms'), t_delay=(Quantity(200., 'ms'), Quantity(800., 'ms')), t_flash2=Quantity(100., 'ms'), t_response=Quantity(500., 'ms'), delay_threshold=500.0, show_rule_cue=True, **kwargs)[source]#
Hierarchical Reasoning task.
Agent must apply conditional rules: - If delay < threshold: Rule A (go toward flash2) - If delay >= threshold: Rule B (go away from flash2)
Rules change in blocks without explicit cues.
Structure: Fixation >> Flash1 >> Delay >> Flash2 >> Response
- Parameters:
t_fixation (
Quantity) – Fixation duration (default: 500ms).t_flash1 (
Quantity) – First flash duration (default: 100ms).t_delay (
tuple) – (min, max) for delay duration (default: (200ms, 800ms)).t_flash2 (
Quantity) – Second flash duration (default: 100ms).t_response (
Quantity) – Response duration (default: 500ms).delay_threshold (
float) – Threshold for rule switching in ms (default: 500.0).seed (int, optional) – Random seed.
Examples
>>> import brainunit as u >>> import braintools >>> task = braintools.cogtask.HierarchicalReasoning( ... delay_threshold=400.0, seed=0, dt=10.0 * u.ms) >>> task.num_inputs, task.num_outputs (5, 3) >>> X, Y, info = task.sample_trial(0) >>> X.shape, Y.shape ((200, 5), (200,)) >>> >>> X, Y = task.batch_sample(4) # time-first: (T, batch, features) >>> X.shape, Y.shape ((200, 4, 5), (200, 4))
- define_features()[source]#
Define input and output features.
Override in subclass for class-based task definition.
- Return type:
- Returns:
input_features (Feature or FeatureSet) – Input feature definitions.
output_features (Feature or FeatureSet) – Output feature definitions.