Skip to content

← machine_learning package

KNNImputation

Impute missing data with an (optionally weighted) average of the k nearest neighbors (KNN).

This method is useful for filling in missing data (encoded by the presence of NaNs in a multivariate manner. The method is stateful and will by default learn an imputation model on the first data that it is called with, and then apply this model on subsequent invocations. . More Info... Version 0.8.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

domain_axes

Axes across which information may be "moved" when imputing missing data. These represent the input domain across which k-NN imputation is applied. Multiple axes may be given by providing a comma-spearated list here; see also the predefined drop-down options. The special value (all others) stands for all axes that are not listed in any of the other two listings.

  • verbose name: Impute Across Axes
  • default value: (all others)
  • port type: ComboPort
  • value type: str (can be None)

aggregate_axes

Axes that have the statistical observations in them. The elements along these axes are treated as the trials or samples that provide redundant observations of the same underlying distribution. See also the previous setting. This is almost always the instance axis (especially if the data has already been segmented, i.e., if the Segmentation node was used), but in some cases it may also be the time axis, or occasionally other axes.

  • verbose name: Treat Elements As Trials/samples Along Axes
  • default value: instance
  • port type: ComboPort
  • value type: str (can be None)

separate_axes

Axes along which to learn separate imputation models. This can be used if it is known that data at one element of this axis is independent from and shares no information with data at another element, so that imputation is best performed separately for each element along this axis. This can also be used if correlations are merely weak across this axis, so that separate models are more accurate.

  • verbose name: Compute Separate Models Along Axes
  • default value:
  • port type: ComboPort
  • value type: str (can be None)

num_neighbors

Number of neighbors to use for imputation. This is the k in k-NN.

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

weighting

Weighting scheme for neighbors. The uniform scheme gives equal weight to all neighbors, while the distance scheme gives weight inversely proportional to the distance to the neighbor. Distance can be more accurate, but in high-dimensional models or with low numbers of neighbors, this can perform less well than the uniform scheme.

  • verbose name: Weighting
  • default value: uniform
  • port type: EnumPort
  • value type: str (can be None)

initialize_once

Calibrate the model only once. If set to False, then this node will recalibrate itself whenever a non-streaming data chunk is received that has both training labels and associated training instances.

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

dont_reset_model

Do not reset the model when the preceding graph is changed. Normally, when certain parameters of preceding nodes are being changed, the model will be reset. If this is enabled, the model will persist, but there is a chance that the model is incompatible when input data format to this node has changed.

  • verbose name: Do Not Reset Model
  • 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)