Coder Social home page Coder Social logo

sharmapulkit / treeinterpretability_anomalyexplanation Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 104.97 MB

Tree Based models for Interpreting Anomalies

PowerShell 0.01% Batchfile 0.01% Makefile 0.01% Python 0.90% HTML 36.10% TeX 0.01% Jupyter Notebook 62.76% JavaScript 0.09% CSS 0.01% C++ 0.10% Shell 0.03%

treeinterpretability_anomalyexplanation's Introduction

CODE: Navigate to ./shap/notebooks for most of the code:

FILE DESCRIPTIONS: Analysse_X_dataset.ipynb: Jupyter Notebook to analyse the corresponding dataset 'X' ../../Accuracy.ipynb: Jupyter Notebook to show results of Attribution Accuracy

postgresql_dataConfig.py: Configuration file for postgreSQL dataset. Declares the feature, treatment, covariate and output variables of postgreSQL dataset.

treeRegressor.py: Train a RandomForest regression model. (Implemented as a Class) evaluateRF.py: Evaluate a trained RF model on the given testing set rf_postgresql.py: Calles treeRegressor to train and save a RF model on postgreSQL dataset interpret.py: Generate and Save Interpretations from TI and SHAP on the given set of data points dataLoader.py: Dataloader utility to load, parse and organize the data into usable/trainable form attributionAccuracy.py: Compute attribution accuracy for Interventional experiment flipped_bits.py: Intervene on the given data and store the updated dataset. Any of the treatment variables can be changed from this script utils.py: Some utility functions useful to print outputs postGresRandomBaselineRankCorrelation.py: Experiment to compute contributions subtracting the median contribution ../../utils.py: Utility to compute and print set overlap and RBO values

CORRESPONDING SHELL FILES: train_rfpostgres.sh --> rf_postgresql.py test_rfpostgres.sh --> evaluateRF.py interpret.sh --> interpret.py timing_analysis.sh --> rf_postgresql.py (Store the running times) griffin_postGresRandomBaselineRankCorrelation.sh --> postGresRandomBaselineRankCorrelation.py

HOW TO: Eg: GET INTERVENTIONAL ACCURACY:

  1. Run train_rfpostgres.sh with dataset path and output path to save the trained RF model
  2. Run test_rfpostgres.sh with test Dataset path to evaluate performance of trained RF model
  3. Run interpret.sh to generate interpretations from SHAP and TI for given test data on the trained model. Input the output directory for TI and SHAP contributions. Provide TimingOutFile for saving the runtime logs.
  4. Run flipped_bits.py to create the intervened dataset
  5. Run attributionAccuracy.py to get Top-1, Top-2, Top-3 Accuracies

Note: RUN "python $script_name -h" for additional options Note: All the paths need to be updated accordingly

SWARM commands:

  1. To Run a python script: sbatch --partition=defq --job-name=jobname ~/nrun.sh python $python_script.py
  2. To see job queue: squeue -u $USERNAME

treeinterpretability_anomalyexplanation's People

Contributors

abhirame avatar apurvaasf avatar sharmapulkit avatar shezanmirzan avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

shezanmirzan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.