Icon

01_Explainable_Artificial_Intelligence_(XAI)_Simple

eXplainable Artificial Intelligence (XAI) - Simple

This application is a simple example of AutoML with KNIME Software for binary and multiclass classification. The output models are then explained via the interactive XAI View, which works for any model the AutoML component produces. Machine Learning Interpretability (MLI) techniques used: SHAP explanations/reason codes, partial dependence, individual conditional expectation (ICE) curves and a surrogate decision tree.

The workflow also works locally on KNIME Analytics Platform. Make sure to use "Apply and Close" in bottom-right corner of each view.

Annotations and comments
  • Break if all models static
  • more faulty models
  • new faulty models
  • create new list as noithing failed during training
  • 0 : not missing performance 1 : missing performance
  • Recall
  • Precision
  • F-measure
  • models with more than one class in the prediction
  • static prediction: models always predicting one class
  • list static models
  • selected metric
  • model names
  • automated selection
  • interactive view selection
  • if multiclass remove conf. matrix metrics
  • activate view
  • fixed colors
  • negative Coehn's kappa is 0
  • add zoom
  • select metric
  • only cat cols output or normal wf
  • decide preprocess workflow cat cols or normal wf
  • decide postprocess workflow cat cols or normal wf
  • update domain
  • Columns to check for unique values
  • Bottom: string
  • Unique count
  • Max number of unique values
  • <= 25 unique values
  • integer features to double
  • cat_present = 1
  • cat_present = 0
  • One hot encoding choice binary
  • One hot encoding choice
  • categorical cols found
  • no categorical
  • remove orignal string cols
  • class
  • features
  • numerical flag
  • num_present = 1
  • num_present = 0
  • do nothing
  • only cat cols and check OHE status
  • decide preproces Ohe =on/off workflow
  • 0: OHE off 1: OHE on
  • 0: train 1: test
  • Preprocessing Missing value
  • feattures+class
  • all features + OHE
  • split string cols
  • OHE + feattures + class
  • column loop and rename
  • Select One-Hot Encoded Columns
  • Remove One-Hot Encoded Columns
  • Combining OHE Removal (if any) with Denormalization (if any)
  • Missing values + Optional One Hot Encoding
  • train / test based on component external settings
  • 0 train 1 test
  • Postprocessing Denormalisation
  • flow variable decides activeness
  • Select columns for normalization
  • bottom: numeric
  • Min-max normalization
  • Normalization mode
  • Preprocessing Normalization
  • decide workflow for transformation
  • check to append OHE workflow
  • pass to denorm
  • ohe check
  • Normalization + OHE
  • Target Col selection
  • DataPrep Transfomations on test data
  • Prediction
  • Failed
  • Unchecked
  • check configuration component
  • Add params to success
  • Break if params are null
  • port 1: extractred params port 0 : other columns
  • extract params
  • port 0: model selected other: model not selected
  • Rename the column containing the objective value.
  • Fail if only one column is available.
  • Set seed.
  • Store the accuracy for k folds
  • Translate to setting names.
  • select the metric
  • keep 1 row
  • select positive class
  • Select search strategy.
  • Send avg accuracy as variaable
  • rename class0
  • rename class1
  • rename prediction column
  • negative
  • positive
  • prediction col creation
  • class0 + class1 + ground truth
  • negative class rename
  • positive class rename
  • binary target + features
  • add back extra columns
  • target class
  • Dense 64
  • softmax
  • Input
  • reshape for dynamic
  • Predict Model
  • Build Model
  • send features for prediction
  • sample 10 rows to pass feature cols
  • selected unselected KDL
  • Binary Multiclass
  • top : features bottom : target
  • extract cols
  • number of units
  • number of samples per epoch
  • check if KDL selected
  • port 1: extractred params port0 : other columns
  • multi target + features
  • input + pred
  • separate features target
  • sigmoid output units
  • Reshape layer
  • add prefix
  • max col
  • pass max
  • pred_0
  • pred
  • rename target
  • original input columns
  • top : pred cols bottom: tareget
  • rename pred cols
  • many to pred col
  • pass numerical features
  • sample 10 rows for identifying features
  • append test rowids to prediction
  • pass rowIds of test column
  • port 1: extractred params port0 : other column
  • Add params to Failed
  • Merge the flow variables
  • Btreak when all selected models are failed
  • Change the col schema
  • port 0: if any model fails port 1: if none fails
  • Remove failed models
  • Remove unselected models
  • Print failed models
  • print all models were successful
  • clean name of failed models
  • Add params to sucess
  • extracted_params
  • Fail if no nominal column is available.
  • Filter nominal columns.
  • remove categorical if any
  • seed_yes
  • select negative col
  • select positive col
  • take 2nd row
  • Create variable for Prediction col
  • Class + features
  • num features + OHE
  • 0 : OHE + numericals 1 : categoricals + numericals
  • Cell to Workflow
  • Choose only prediction related cols
  • Rename Prediction to Modelname Prediction
  • RowId so that GLM can be concat with other models
  • Pass the rename prediction col. name
  • create flow variable of current prediction col.
  • Executes the prediction workflow
  • 0: features 1: gound truth
  • 0: trained models table 1: new data / test data / validation data
  • manage missing values in predictions columuns
  • if binary
  • Iterating Model by Model
  • overall stats
  • positive class
  • handle the special characters in class names
  • One Hot Encoding
  • Target Selection
  • Number of CV Folds
  • Train / Test Split
  • unique values removal
  • Select Models
  • features + target
  • choose target
  • TTR divide by 100
  • Store the model names
  • remove all numerical
  • Multiclass flag
  • Rename target col
  • Unique value in target
  • Binary or Multi class
  • Performance Metric
  • 1. pre-process model 2. ML model 3. post-process model
  • titanic.csv
  • Top: rest of the data Bottom: rows to explain
  • port 0: Dataset Sample port 1: AutoML Model port 2: Explainable Instances
  • break if rows to explain is empty
  • remove target
  • rows to explain
  • break if explained rows more than 100
  • concat rows not in instances to explain
  • check if the rows to be explained are in sampling table
  • break if rows lesser than explained instances
  • rows_provided
  • no_rows to explain
  • less rows fpound
  • remove confidence column
  • keep only selected class predictions
  • remove target column
  • Not all features supplied
  • Rename prob col
  • Rename prediction col
  • P(target Column)
  • P(target = positive)
  • Model+Predictions
  • wild model
  • break if sampling table found empty
  • traget column
  • check if samling table is empty
  • unique
  • new name
  • Binary - Multiclass flag
  • port 0: Partial Dep. (PDP) port 1: Surrogate Dec. Tree port 2: Explained Instances port 3: Feature Importance port 4: Bubble Explanations port 5: Output data
  • surrogate tree view
  • Support 500 features max
  • remove exp_Counter
  • rename Row ID col
  • rename pred prob column
  • remove prefix pdp
  • remove model exp prediction
  • group by pdp and exp
  • name the pred col as p()
  • name of the exp col to remove
  • prefix addition exp
  • prefix pdp
  • prefix addition prepdp
  • remove model name col
  • remove model pred col
  • add float varibales like model predictions
  • rename counter
  • rename to pred col
  • remove counter
  • filter the pred col
  • counter to sort
  • domain for pred col
  • join on row id
  • pos
  • non pos
  • filter the row class to xplain
  • Multiclass / Binary
  • rowid ascending
  • rename class to explain with space
  • calculate standard dev
  • rearrange cols
  • add 0.5 to set bubble size
  • remove confidence col
  • if the executer fails
  • convert shap ID to int
  • fail if no numerical column is provided
  • fail if no column is selected
  • fail if rows number = 0
  • list over feature columns
  • take out categorical columns
  • remove unnecessary statistics
  • add feature name
  • create a counter
  • create table with numSamples rows
  • transform counter to feature domain
  • exclude selected column
  • include selected column
  • make sure that the output table has the same column order as the input table
  • extract RowId
  • create breakpoint message
  • set number of samples
  • add back categorical columns
  • reset rowid
  • predictions col
  • remove model col as feature
  • remove model pred col as feature
  • non positive class
  • remove pred col name
  • port 0 : not using SHAP summarizer port 1 : using SHAP summarizer
  • select 1000 rows
  • number of coalition
  • Decision on using Shap Summarizer
  • Append the mumeric and string Cols
  • Append the SHAP weights col
  • SHAP Weight col
  • Pick data based on the case
  • if empty means no string columns proceed with kmeans on numerical columns
  • Check the first row of the string columns
  • Append OHE string cols to numeric cols
  • Append the numeric with decoded OHE cols
  • Split the columns into numeric and String columns
  • Split into numeric and OHE cols
  • Number of Prototypes
  • check if the normalisation flag is set
  • Create flow variable with value "top" if table has more than 0 rows, otherwise "bottom"
  • Pass the col names to the loop
  • Extract the specs of Numerical columns
  • Start with string cols
  • Brealpoint to check if empty cols
  • Select the sum
  • Upper output port is activ, if not all column headers are equivalent Lower output port is active, if all column header are equivalent
  • Full outer join on column headers. If a column header is only in one table it will create a missing values
  • Sum of Missing values
  • Misising value treatment
  • Table with non empty columns
  • Shuffle before applying k-Means to avoid order related issues
  • Send the String Cols names
  • Extract cluster sizes
  • Rename the col SHAP weights
  • only explained class
  • using SHAP Summarizer Sampling weight
  • sort violins
  • html title
  • DT title
  • Violin title
  • Bubble title
  • PDP title

Nodes

Extensions

Links