npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-shap-explainers

v16.0.0

Published

Shap visual explainers

Downloads

15

Readme

ShapExplainers

This project contains the Angular components for the SHAP visual explainers:

  1. Shap Additive Force plot
  2. Shap Additive Force Array plot
  3. Custom: Shap Influence plot

The project is based on the original code by https://github.com/slundberg/shap

Help us improve this project!

We want to improve and expand on the project. Help us learn how to do that best by filling out this survey

 

Installation

  1. Run npm i ngx-shap-explainers
  2. Add ShapExplainersModule to the imports array
  3. Use the one of the following component selectors:
    • <shap-additive-force>
    • <shap-additive-force-array>
    • <shap-influence>

 

API - How to use the components

shap-additive-force component input parameters:

Changing the colors of the plot. Requires an array of 2 colors.
plotColors: string[] = ['rgb(222, 53, 13)', 'rgb(111, 207, 151)'];

Changing the x-axis type between log-odds (identity) or probabilities (logit).
link: 'logit' | 'identity' = 'identity';

Setting the base value (middle point) for the plot:
baseValue: number = 0.0;

Set the label(s) for the output variables
outNames: string[] = ['Color rating'];

Hide the plot bars:
hideBars: boolean = false;

Set the margin for the labels (labels show up when hovering the bars when not enough space to display the labels)
labelMargin: number = 0;

Hide the label attached to the base value
hideBaseValueLabel: boolean = false;

The data with the feature names and feature values
data: AdditiveForceData;

 

shap-additive-force-array component input parameters:

Set the offset from the top
topOffset: number = 28;

Set the offset from the left
leftOffset: number = 80;

Set the offset from the right
rightOffset: number = 10;

Set the height of the graph
height: number = 350;

Changing the colors of the plot. Requires an array of 2 colors.
plotColors: string[] = ['rgb(222, 53, 13)', 'rgb(111, 207, 151)'];

Changing the x-axis type between log-odds (identity) or probabilities (logit).
link: 'logit' | 'identity' = 'identity';

Setting the base value (middle point) for the plot:
baseValue: number = 0.0;

Set the label(s) for the output variables
outNames: string[] = ['Color rating'];

The data with the feature names and feature values
data: AdditiveForceArrayData

 

shap-influence component input parameters:

Changing the colors of the signs (+/-). Requires an array of 2 colors.
influenceColors: string[] = ['rgb(222, 53, 13)', 'rgb(111, 207, 151)'];

Set the prediction values
predictions: number[] = [1];

Set the prediction label names
predictionNames: string[] = ['Income']

Set the amount of influence labels that are being displayed
labelAmount: number = 7;

 

Interfaces

AdditiveForceData {
    featureNames: {
        [key: string]: string;
    };
    features: {
        [key: string]: { [key: string]: number };
    };
}

AdditiveForceArrayData {
    featureNames: {
        [key: string]: string;
    };
    explanations: {
        outValue: number;
        simIndex: number;
        features: {
            [key: string]: { value: number; effect: number; ind?: number };
        };
    }[];
}

InfluenceData {
    featureNames: {
        [key: string]: string;
    };
    valueNames: {
        [key: string]: string;
    };
    features: {
        [key: string]: { [key: string]: number };
    };
}

 

Repository

Deeploy-ml/shap-explainers