Module: workflow

Data processing workflow nodes.

These processing nodes serve to build complex processing workflows, particularly during offline analysis and evaluation of machine learning pipelines on separate training and test data.

Crossvalidation

Perform a cross-validation and return a loss measure.

This node receives an evaluation data set and a reference to a processing node or method that shall be tested on the given data. The processing node is expected to produce predictions whose discrepancy with respect to the ground truth in the data (the loss) is being measured. Typically the method is a node of type Learning Method, and the wire goes from the this port of the node to the method port of the cross-validation. The cross-validation repeatedly splits the dataset into training and test portion and applies the method to these portions to obtain test-set predictions. Loss statistics are available on the output ports.

More Info...

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data for evaluation.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • method
    Method to use.

    • verbose name: Method
    • default value: None
    • port type: DataPort
    • value type: BaseNode (can be None)
    • data direction: IN
  • loss
    Loss measure.

    • verbose name: Loss
    • default value: None
    • port type: DataPort
    • value type: float (can be None)
    • data direction: OUT
  • loss_std
    Loss standard deviation.

    • verbose name: Loss Std
    • default value: None
    • port type: DataPort
    • value type: float (can be None)
    • data direction: OUT
  • loss_med
    Loss median.

    • verbose name: Loss Med
    • default value: None
    • port type: DataPort
    • value type: float (can be None)
    • data direction: OUT
  • folds
    Number of cross-validation folds. If >1 this is k-fold CV. If set to 1, this is leave-one-out CV. If 0<folds<1, this is p-holdout CV. If set to 0, the training-set error is computed.

    • verbose name: Folds
    • default value: 5
    • port type: FloatPort
    • value type: float (can be None)
  • loss_metric
    Loss metric. The following measures can be calculated both offline and online: MCR is mis-classification rate (aka error rate), MSE is mean-squared error, MAE is mean absolute error, Sign is the sign error, Bias is the prediction bias. The following measures are currently only available during offline computations: SMAE is the standardized mean absolute error, SMSE is the standardized mean-squared error, max is the maximum error, RMS is the root mean squared error, MedSE is the median squared error, MedAE is the median absolute error, SMedAE is the standardized median absolute error, AUC is negative area under ROC curve, R2 is the R-squared loss, CrossEnt is the cross-entropy loss, ExpVar is the negative explained variance.

    • verbose name: Loss Metric
    • default value: MCR
    • port type: EnumPort
    • value type: object (can be None)
  • trial_size
    Assumed size of a trial. In seconds relative to the respective markers. This is used to be able to perform continuous-time selection around markers. Should be large enough to encompass the segment size used in the Segmentation step of the given method, if any.

    • verbose name: Segment Length
    • default value: (-1, 2)
    • port type: Port
    • value type: object (can be None)
  • randomized
    Whether to perform randomized or blockwise cross-validation. Blockwise is preferred for data stemming from a time series.

    • verbose name: Randomized
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • stratified
    Use stratified CV. This means that all the folds have the same relative percentage of trials in each class.

    • verbose name: Stratified
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • repeats
    Number of repetitions (only useful in case of randomized CV).

    • verbose name: Number Of Repetitions
    • default value: 1
    • port type: IntPort
    • value type: int (can be None)
  • random_seed
    Random seed (int or None). Different values will give somewhat different outcomes.

    • verbose name: Random Seed
    • default value: 12345
    • port type: IntPort
    • value type: int (can be None)
  • trial_margin
    Margin around the specified trial length. This is to avoid cutting the signal time axis too short near the edge of segments.

    • verbose name: Trial Margin
    • default value: 0.1
    • port type: FloatPort
    • value type: float (can be None)

InputPort

Define a data input of the patch.

Input ports are used to declare external data inputs of the patch, and can be used to specify the interaction of the patch with its external environment. Different runtime systems can then implement this declaration in various ways (e.g., provide API endpoints to allow for data ingress into the patch). If the patch is used to implement the inner workings of a node, then the input ports map to the data inlets of the node.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data received.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: OUT
  • portname
    Name of the port. If the enclosing node has pre-defined port names, make sure that your port name matches one of those.

    • verbose name: Portname
    • default value: data
    • port type: StringPort
    • value type: str (can be None)
  • default
    Default value of the port (Python literal expression).

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

LearningMethod

Represents a learning method implemented by a graph.

This node can be used to instantiate a sub-graph that implements a learning method inside another graph. The sub-graph must have an input and an output port node of name 'data'

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to process.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: INOUT
  • filename
    Name of the patch file to load.

    • verbose name: Filename
    • default value: None
    • port type: StringPort
    • value type: str (can be None)

OutputPort

Define a data output of the patch.

Output ports are used to declare external data outputs of the patch, and can be used to specify the interaction of the patch with its external environment. Different runtime systems can then implement this declaration in various ways (e.g., provide API endpoints to allow for data egress from the patch). If the patch is used to implement the inner workings of a node, then the output ports map to the data outlets of the node.

Version 1.0.0

Ports/Properties

  • 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)
  • data
    Data to emit.

    • verbose name: Data
    • default value: None
    • port type: DataPort
    • value type: Packet (can be None)
    • data direction: IN
  • portname
    Name of the port. If the enclosing node has pre-defined port names, make sure that your port name matches one of those.

    • verbose name: Portname
    • default value: data
    • port type: StringPort
    • value type: str (can be None)

ParameterPort

Define an external parameter of the patch.

This node is used to create patches that expose parameters. The runtime system that runs the patch can then expose these parameters to the outside environment in various ways. Some examples are patches that are uploaded to NeuroScale and which shall be user configurable though APIs or GUIs, or patches that implement the inner workings of a NeuroPype node, and whose parameters are used as the configurable properties of that node. Parameters are quite rich objects, and include, for instance, the name of the parameter, its type (e.g., integer or string), an optional help text, the default value if the parameter is not assigned, and various other useful settings that govern how the parameter shall behave in specific circumstances. There is a close similarity between the features of a ParameterPort node, and of the so-called Port objects that are part of the the machinery of NeuroPype, and which are used to declare all the configurable parameters, as well as data inputs and outputs of a node. While Port objects are used in Python code to express parameters of a node, the ParameterPort object is used in a flow graph to express parameters of a graph.

Version 1.0.0

Ports/Properties

  • 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)
  • value
    Data assigned.

    • verbose name: Value
    • default value: None
    • port type: DataPort
    • value type: object (can be None)
    • data direction: OUT
  • portname
    Name of the port. This is the identifier under which the parameter is exposed. If this pipeline is meant to be with a meta-node that uses pre-defined port names, make sure that your port name matches one of those.

    • verbose name: Internal Name
    • default value: data
    • port type: StringPort
    • value type: str (can be None)
  • desc
    Description of the port. This description may be shown in GUIs and auto-generated documentation.

    • verbose name: Description
    • default value:
    • port type: StringPort
    • value type: str (can be None)
  • port_category
    Human-readable category under which the port falls.

    • verbose name: Port Category
    • default value:
    • port type: StringPort
    • value type: str (can be None)
  • default
    Default value of the port.

    • verbose name: Default Value
    • default value:
    • port type: StringPort
    • value type: str (can be None)
  • verbose_name
    Optionally the verbose (human-friendly) name of this port. Overriding this will override what is shown in the GUI (the default behavior is to derive the human-friendly name from the port name by replacing underscores with spaces, and capitalizing the first character.

    • verbose name: Human-Readable Name (Optional)
    • default value: None
    • port type: StringPort
    • value type: str (can be None)
  • value_type
    Default value type of the port. This determines what type of port is generated for the enclosing node.

    • verbose name: Value Type
    • default value: string
    • port type: EnumPort
    • value type: object (can be None)
  • enum_cases
    DEPRECATED (use domain instead). List of selectable enum options, if the value type is set to enum.

    • verbose name: Enum Cases
    • default value: []
    • port type: ListPort
    • value type: list (can be None)
  • is_multiselect
    DEPRECATED (use select instead). Allow multiple selections if the value type is enum.

    • verbose name: Is Multiselect
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • domain
    Defines the acceptable values for this port in the form of a list of two value bounds (for int or float), or a list of values (for int, float or string). Also takes a special case of a dictionary in the following format: {'set1':['value1', 'value2'], 'set2':['value1', 'value2'] ...} where 'set1' and 'set2' are possible values in another parameter port defined in the 'relationships' property of this node (in this format: 'domain.key:portname'), which allow a client application to dynamically determine which set of values are the acceptable values for this port. If 'relationships' specifies a 'domain.key', then this property must contain a dictionary, whose keys match the expected values from the node defined in 'relationships'. Note: The list or dictionary for this node can be loaded from a text file by specifying the filename here in the following format: . The default expected location of this file is the 'resources' folder of the Neuropype installation.

    • verbose name: Domain
    • default value: None
    • port type: StringPort
    • value type: str (can be None)
  • select
    Whether a client application should present a list of values to be selected from and whether only one or multiple can be selected. If not set to 'none', the selectable values must be defined in the 'domain' property of this node.

    • verbose name: Select
    • default value: none
    • port type: EnumPort
    • value type: object (can be None)
  • expert
    Whether this port is for use by experts. Some user interfaces may not show expert ports unless the interface is set to "expert" mode itself.

    • verbose name: This Port Is For Use By Experts
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • autocast
    Whether to automatically cast values into the type of the port. For instance, when an integer is assigned to a float port.

    • verbose name: Auto-Cast To Value Type
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • canbenone
    Whether assignments to this port can be None. Otherwise assigning None values to this port will give an error.

    • verbose name: Can Be None
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • safe
    Whether allowing users to enter arbitrary values to this port is safe. Ports that could be used for script injection (e.g., in cloud environments) would be considered not safe. This only has an effect the when the value_type is object.

    • verbose name: Safe For Network Use
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • is_filename
    Whether this port accepts file names. This has the consequence that strings will be properly path-normalized. This also applies to parameters that can be lists of file names (e.g., comma-separated).

    • verbose name: Is Filename
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • verbose
    Verbose output for port assignments.

    • verbose name: Verbose
    • default value: False
    • port type: BoolPort
    • value type: bool (can be None)
  • is_visible
    Whether the value of this parameter port is visible in a client application.

    • verbose name: Is Visible
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • editable
    Whether the value of this parameter port is editable in a client application.

    • verbose name: Editable
    • default value: True
    • port type: BoolPort
    • value type: bool (can be None)
  • relationships
    Defines relationships with other parameter ports in a pipeline, which may control elements of this port, such as the domain, visibility, or editability. At present, the following syntax is supported 'domain:portname' or 'editable:portname'.

    • verbose name: Relationships
    • default value: []
    • port type: ListPort
    • value type: list (can be None)