Hub
Pricing About
NodeNode / LoopStart

Shapley Values Loop Start

KNIME LabsML Interpretability
Drag & drop
Like

Shapley Values originated in game theory and in the context of machine learning they have recently became a popular tool for the explanation of model predictions. The Shapley Value of a feature for a certain row and prediction indicates how much the feature has contributed to the deviation of the prediction from the base prediction (i.e. the mean prediction over the full sampling data). In theory the Shapley Values of all features add up to the difference between the mean prediction and the actual prediction but this loop only produces approximations because it is typically infeasible to calculate the exact Shapley Values.

Usage

A typical Shapley Values loop will consist of only three nodes: The Shapley Values Loop Start node, the predictor node for the model you want to explain (e.g. a Random Forest Predictor node) and the Shapley Values Loop End node.

For each row in the ROI (Row of Interest) table, the Shapley Values Loop Start node creates a number of perturbed rows i.e. rows where some of the features are randomly exchanged with the features from rows in the sampling table (for the exact details of the algorithm we refer to algorithm one in the paper Explaining prediction models and individual predictions with feature contributions by Strumbelj and Kononenko). Your task is to obtain predictions for these permuted rows (usually via the Predictor node corresponding to your model). The Shapley Values Loop End node collects these predictions and calculates an approximation of the Shapley Values for each feature target combination.

A note on collections and vectors

These nodes support collection and vector columns such as List columns, Bit Vector and Byte Vector columns, in case of which each element of the position/vector can be treated as an individual feature. Note that this requires all collections/vectors in a single column to be of the same length i.e. contain the same number of elements. It is also possible to treat collections and vectors as single features, in which case the respective option has to be set in the dialog.

Node details

Input ports
  1. Type: Table
    Table containing the rows to explain
    Table containing the rows to be explained.
  2. Type: Table
    Sampling data
    Table containing rows used to perturb rows in the first table.
Output ports
  1. Type: Table
    Perturbed rows
    Perturbed rows.

Extension

The Shapley Values Loop Start node is part of this extension:

  1. Go to item

Related workflows & nodes

  1. Go to item
  2. Go to item
  3. Go to item

KNIME
Open for Innovation

KNIME AG
Talacker 50
8001 Zurich, Switzerland
  • Software
  • Getting started
  • Documentation
  • Courses + Certification
  • Solutions
  • KNIME Hub
  • KNIME Forum
  • Blog
  • Events
  • Partner
  • Developers
  • KNIME Home
  • Careers
  • Contact us
Download KNIME Analytics Platform Read more about KNIME Business Hub
© 2025 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Data Processing Agreement
  • Credits