Skip to content

← machine_learning package

StackedPredictor

Learn a binary meta-predictor from out-of-fold predictions of several distinct base methods.

This node complements MethodEnsemblePredictor: whereas the fixed-rule ensemble combines final predictions using a static rule such as a mean or vote, this node first generates out-of-sample predictions for each wrapped method using an internal cross-validation, then fits a second-stage meta-model that learns how to combine those method-specific probabilities. The default Bayesian option uses a log-opinion pool with simplex-constrained weights, while the legacy logistic option remains available as a backward-compatible fallback. The node is intended as a narrow first version of stacking for binary classification on segmented packets with an instance axis. Each wired method should therefore emit class probabilities that can be interpreted as binary probabilities. Once trained, the node fits each base method once on the full dataset and uses those full-data models together with the learned meta-model for later predictions on new data. Version 0.7.0

Ports/Properties

data

Data to process.

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

method1

Base method 1.

  • verbose name: Method1
  • default value: None
  • port type: GraphPort
  • value type: Graph

method1__signature

Argument names of the first base method. Each method should generally start with a Placeholder named data and end in a probabilistic classifier or wrapper that emits binary class probabilities. Optional placeholders such as is_training, random_seed, and index may also be exposed.

  • verbose name: Method1 [Signature]
  • default value: (data)
  • port type: Port
  • value type: object (can be None)

method2

Base method 2.

  • verbose name: Method2
  • default value: None
  • port type: GraphPort
  • value type: Graph

method2__signature

Signature for the "method2" input. This represents the signature for the subgraph that is wired into the "method2" port. This is formatted as in (a,b,c) where a,b,c are names of placeholders that are expected in the subgraph that goes into the "method2" port. Alternatively, it can also be provided in data structure form as a list of lists, as in: [['a','b','c']].

  • verbose name: Method2 [Signature]
  • default value: (data)
  • port type: Port
  • value type: object (can be None)

method3

Base method 3.

  • verbose name: Method3
  • default value: None
  • port type: GraphPort
  • value type: Graph

method3__signature

Signature for the "method3" input. This represents the signature for the subgraph that is wired into the "method3" port. This is formatted as in (a,b,c) where a,b,c are names of placeholders that are expected in the subgraph that goes into the "method3" port. Alternatively, it can also be provided in data structure form as a list of lists, as in: [['a','b','c']].

  • verbose name: Method3 [Signature]
  • default value: (data)
  • port type: Port
  • value type: object (can be None)

method4

Base method 4.

  • verbose name: Method4
  • default value: None
  • port type: GraphPort
  • value type: Graph

method4__signature

Signature for the "method4" input. This represents the signature for the subgraph that is wired into the "method4" port. This is formatted as in (a,b,c) where a,b,c are names of placeholders that are expected in the subgraph that goes into the "method4" port. Alternatively, it can also be provided in data structure form as a list of lists, as in: [['a','b','c']].

  • verbose name: Method4 [Signature]
  • default value: (data)
  • port type: Port
  • value type: object (can be None)

method5

Base method 5.

  • verbose name: Method5
  • default value: None
  • port type: GraphPort
  • value type: Graph

method5__signature

Signature for the "method5" input. This represents the signature for the subgraph that is wired into the "method5" port. This is formatted as in (a,b,c) where a,b,c are names of placeholders that are expected in the subgraph that goes into the "method5" port. Alternatively, it can also be provided in data structure form as a list of lists, as in: [['a','b','c']].

  • verbose name: Method5 [Signature]
  • default value: (data)
  • port type: Port
  • value type: object (can be None)

enabled

Whether to enable stacking. If disabled, only the first wired method is used and the learned meta-model is bypassed.

  • verbose name: Enabled
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

meta_model

Meta-model used to combine out-of-fold base predictions. 'bayesian' (default) uses a log-opinion pool with non-negative simplex weights and a symmetric Dirichlet prior fit by NumPyro NUTS. 'logistic' uses the legacy L2-regularized sklearn LogisticRegression stacker.

  • verbose name: Meta Model
  • default value: bayesian
  • port type: EnumPort
  • value type: str (can be None)

regularization_strength

Inverse regularization strength C of the logistic meta-model. Higher values weaken the regularization, while lower values shrink the learned combination weights more strongly. Only used when meta_model='logistic'.

  • verbose name: Regularization Strength
  • default value: 1.0
  • port type: FloatPort
  • value type: float (can be None)

fit_intercept

Whether to fit an intercept term in the logistic meta-model. Only used when meta_model='logistic'.

  • verbose name: Fit Intercept
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

dirichlet_concentration

Concentration parameter of the symmetric Dirichlet prior on the simplex weights of the Bayesian meta-model. Values above 1 shrink toward uniform weighting; values below 1 encourage sparse corner solutions. Only used when meta_model='bayesian'.

  • verbose name: Dirichlet Concentration
  • default value: 2.0
  • port type: FloatPort
  • value type: float (can be None)

meta_logit_clip

Clipping bound applied to method probabilities before logit transformation in the Bayesian meta-model. Tighter clipping caps the veto effect from overconfident component methods. Only used when meta_model='bayesian'.

  • verbose name: Meta Logit Clip
  • default value: 0.01
  • port type: FloatPort
  • value type: float (can be None)

cond_field

Name of the instance-axis field that contains the class labels used to fit the stacker.

  • verbose name: Cond Field
  • default value: TargetValue
  • port type: StringPort
  • value type: str (can be None)

num_folds

Number of internal cross-validation folds used to generate out-of-fold base predictions for the stacker.

  • verbose name: Number Of Folds
  • default value: 5
  • port type: IntPort
  • value type: int (can be None)

cv_group_field

Optional grouping field for the internal cross-validation. If given, validation folds contain unseen groups such as sessions or subjects.

  • verbose name: Grouping Field (Cross-Validation)
  • default value:
  • port type: StringPort
  • value type: str (can be None)

stratified

Whether to stratify the internal cross-validation by class label where supported.

  • verbose name: Stratified
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

randomized

Whether to randomize the internal cross-validation where supported by the chosen fold scheme.

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

repeats

Number of repeated randomized CV runs used to generate out-of-fold predictions. Repeated predictions for a given instance are averaged before fitting the meta-model.

  • verbose name: Repeats
  • default value: 1
  • port type: IntPort
  • value type: int (can be None)

censor_labels

Whether to clear the labels from each validation split before applying the base methods. This can help avoid accidental leakage in pipelines that inspect labels at prediction time.

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

num_warmup

Number of NUTS warmup (burn-in) steps used for the Bayesian meta-model. Only used when meta_model='bayesian'.

  • verbose name: Number Of Warmup Steps
  • default value: 300
  • port type: IntPort
  • value type: int (can be None)

num_mcmc_samples

Number of NUTS posterior samples drawn per chain for the Bayesian meta-model. Only used when meta_model='bayesian'.

  • verbose name: Number Of Mcmc Samples
  • default value: 500
  • port type: IntPort
  • value type: int (can be None)

num_chains

Number of independent NUTS chains for the Bayesian meta-model. Multiple chains enable between-chain R-hat convergence diagnostics, which are more reliable than single-chain split R-hat. Chains are run sequentially to avoid conflicts with any outer multiprocessing in the training pipeline. Only used when meta_model='bayesian'.

  • verbose name: Number Of Mcmc Chains
  • default value: 2
  • port type: IntPort
  • value type: int (can be None)

initialize_once

Calibrate the wrapped methods and the meta-model only once. If set to False, the stacker is retrained whenever a labeled non-streaming dataset is received.

  • verbose name: Calibrate Only Once
  • default value: True
  • port type: BoolPort
  • value type: bool (can be None)

dont_reset_model

Do not reset the wrapped methods when the preceding graph is changed.

  • verbose name: Do Not Reset Model
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

random_seed

Seed for the internal cross-validation and for wrapped methods that accept a random_seed placeholder. This can either be a splittable seed or a plain integer.

  • verbose name: Random Seed
  • default value: 12345
  • port type: Port
  • value type: AnyNumeric

verbosity

Verbosity level for diagnostics.

  • verbose name: Verbosity
  • default value: 1
  • port type: IntPort
  • value type: int (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)