braintools.cogtask.match_label#
- braintools.cogtask.match_label(match_key, match_label=1, nonmatch_label=2)[source]#
Create a label for match/non-match tasks.
- Parameters:
- Returns:
Label function (ctx, feature) -> int
- Return type:
Examples
>>> from braintools.cogtask import Context, match_label >>> spec = match_label('is_match') # e.g. outputs={'label': spec} >>> ctx = Context() >>> ctx['is_match'] = True >>> int(spec(ctx, None)) 1 >>> ctx['is_match'] = False >>> int(spec(ctx, None)) 2 >>> int(match_label('is_match', match_label=3, nonmatch_label=4)(ctx, None)) 4