Giter Club home page Giter Club logo

disc's Introduction

Interpretable Sequence Classification via Discrete Optimization

This repository contains the code for DISC and the other baselines from the paper Interpretable Sequence Classification via Discrete Optimization by Shvo, Li, Toro Icarte, and McIlraith.

Please cite this paper if you use any part of this code for academic research.

@article{shvo2020interpretable,
title={Interpretable Sequence Classification via Discrete Optimization},
author={Shvo, Maayan and Li, Andrew C and Toro Icarte, Rodrigo and McIlraith, Sheila A},
journal={arXiv preprint arXiv:2010.02819},
year={2020}}

Overview

DISC is an efficient mixed integer linear programming method for learning deterministic finite automata (DFA) from a set of positive (accepted) and negative (rejected) sequences of symbols. Unlike most existing DFA-learning methods, we aim to perform well on real-world sequence data, even when the data is noisy (and not only when the data is generated by a regular language). Three main hyperparameters affect the learning:

  • q_max: The maximum number of states in the learned DFA.
  • λ_t: A regularization penalty for (non-self-loop) edge transitions.
  • λ_a: A regularization penalty for state-occupancy in non-absorbing states (we define states 1 and 2 to be absorbing states which always self-transition, with state 1 as a non-accepting state and state 2 as an accepting state).

This implementation is designed for sequence classification tasks with multiple classes. A single DFA is learned for each class and Bayesian inference is used to produce a probability distribution over possible classes.

Quick-start guide

Running DISC requires Gurobi Optimizer (available at https://www.gurobi.com) and an active license (academic licenses can be obtained for free). You may need to install some minor Python packages via pip.

To run DISC on the Alfred dataset, use the command python3 run_tree_model.py --dataset=alfred --qmax=5 --id=1 (or alternatively, set these parameters in run_tree_model.py:293-298).

For more information on how to run the code, see the Detailed running instructions section below.

Detailed running instructions

DISC is implemented in the files {DFA_utils_tree_minerror, read_traces, run_tree_model, tree_minerror, tree_utils}.py and is run with python3 run_tree_model.py.

For DISC, LSTM (run from lstm.py), and HMM (run from supervised_hmm.py), the file GLOBAL_VARS.py contains important flags. VALIDATION determines whether part of the training data will be used as a validation set in order to choose hyperparameters. TREE_MINERROR, if true, uses DISC when run_tree_model.py is run, and otherwise runs DFA-FT, another baseline in our experiments. MULTILABEL, if true, assumes there can be multiple labels associated with each observation trace.

run_tree_model.py:150-151 contains lists of hyperparameter values for λ_t, λ_a to search over, when looking to find the best model. run_tree_model.py:296 allows you to set the value of q_max.

Several publicly available datasets are provided in the traces/ directory and can be run directly with DISC. We provide 30 randomly split training and testing sets for each dataset.

disc's People

Contributors

andrewli77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

taokong1017

disc's Issues

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.