braintools.cogtask.comparison_label#
- braintools.cogtask.comparison_label(comparison_key, greater_label=1, less_label=2)[source]#
Create a label for comparison tasks.
- Parameters:
- Returns:
Label function (ctx, feature) -> int
- Return type:
Examples
>>> from braintools.cogtask import Context, comparison_label >>> spec = comparison_label('test_greater_than_sample') >>> ctx = Context() >>> ctx['test_greater_than_sample'] = True >>> int(spec(ctx, None)) 1 >>> ctx['test_greater_than_sample'] = False >>> int(spec(ctx, None)) 2