Skip to content

← machine_learning package

AssignTargets

Select which markers contain event-related signal activity, and optionally assign numeric target values to these markers for use in machine learning.

This node is part of a standard workflow for analysis of event-related signal activity, and optionally for machine learning on that activity. First of all, this node allows you to define which of the (possibly many) markers in the data should be used for event-related analysis. Second, you can assign different numeric values to different events (since each event has an associated string, you can give a mapping that assigns different values to different strings). There is also an option to accept any marker strings that can be converted into numbers, and take these numbers as the target values (this is useful for the case where regression targets are being specified, instead of classification). Once your markers are annotated in this way in the data, subsequent nodes will act on that subset of markers (e.g., the Segmentation node will extract segments around only the target markers), and if you have assigned numeric target values to specific markers, any subsequent machine learning nodes will interpret these values as the desired output values (or "labels") that the machine learning node is supposed to predict whenever it sees data that looks like what it observed around those markers in its training data. Thus, a typical workflow is to have an Assign Target Markers node, followed by a Segmentation node, optionally followed by some segment processing, followed by a machine learning node; usually you also need a way to feed both training and test/live data into this chain of nodes, e.g., using the Inject Calibration Data node or the Accumulate Calibration Data node prior to the Assign Target Markers node. Tip: since this node only distinguishes markers based on exact string matching, you may need to preprocess your marker strings beforehand using other nodes. It can also be helpful to insert new markers in the data based on custom criteria using, e.g., the Insert Markers node, before applying this node. Version 1.0.2

Ports/Properties

data

Data to process.

  • verbose name: Data
  • default value: None
  • port type: DataPort
  • value type: Packet (can be None)
  • data direction: INOUT

mapping

Mapping of matching criteria to target values. Any instances that match a given criterion (e.g., marker name or name pattern) will be assigned the associated target value. The format of the criteria can be overridden by mapping_format. The mapping can be given either fully explicit as a dictionary of {crit1: target-value1, crit2: target-value2, ...}, or using the shorthand list notation [crit1, crit3, crit3], which is equivalent to {crit1:0, crit2:1, crit3:3, ...}. An unorderered set {crit1, crit2, crit3} can be given to simply set target values for any matching criterion to 1.

  • verbose name: Value Assignment
  • default value: {'M1': 0, 'M2': 1}
  • port type: Port
  • value type: object (can be None)

mapping_format

Format of the criterion strings. If set to 'names', each instance (e.g., marker string) needs to match the provided string exactly. If set to 'wildcards', the criterion is a wildcard expression that may include * or ? characters. If set to 'conditions', the mapping can be a restricted Python expression that may refer to other instance fields (e.g., "Marker == 'left' and Duration > 4.0", provided that the the instances have fields named Marker and Duration). See NeuroPype's QueryGrammar for more details on the available functions. Also, in this mode the mapping targets are allowed to be strings, which are then evaluated as formulas (possibly dependent on other instance fields) to calculate the target value. The special format 'passthrough-numbers' ignores the mapping entirely, and simply converts the marker strings to numbers, and uses those as target values. The 'compat' format is primarily for backwards compatibility with the settings of some deprecated fields. It is recommended to instead always select the syntax that you're using explicitly.

  • verbose name: Mapping Format
  • default value: compat
  • port type: EnumPort
  • value type: str (can be None)

iv_column

Choose which column of the instance axis data table to use for mapping, if mapping is 'names' or 'wildcards'. This will almost always be 'Marker' (the default).

  • verbose name: Default Condition Field
  • default value: Marker
  • port type: StringPort
  • value type: str (can be None)

is_categorical

If set then the TargetValue column in the IV table will be marked as categorical.

  • verbose name: Is Categorical
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

also_legacy_output

Also write the target values in the legacy location. The target values will also be written into the data tensor (block.data).

  • verbose name: Also Legacy Output
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

use_numbers

Alternatively convert number strings to target values. If this is checked, the marker assignment is ignored, and the node will treat any marker string that can be converted to a number as a target marker, and use the corresponding number as the target value. This is useful when regression targets are encoded in marker strings.

  • verbose name: Use Numbers Instead (Regression)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

support_wildcards

Support wildcard matching.

  • verbose name: Support Wildcards
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

verbose

Enable verbose output.

  • verbose name: Verbose
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

  • verbose name: Set Breakpoint (Debug Only)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

  • verbose name: Metadata
  • default value: {}
  • port type: DictPort
  • value type: dict (can be None)