GithubHelp home page GithubHelp logo

khalefa-phd / draco Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uwdata/draco

0.0 1.0 0.0 38.33 MB

Visualization Constraints and Weight Learning

Home Page: https://uwdata.github.io/draco/

License: BSD 3-Clause "New" or "Revised" License

Python 40.64% JavaScript 5.95% Shell 1.91% TypeScript 51.49%

draco's Introduction

Formalizing Visualization Design Knowledge as Constraints

Build Status Coverage Status PyPi Code style: black code style: prettier

Draco is a formal framework for representing design knowledge about effective visualization design as a collection of constraints. You can use Draco to find effective visualization visual designs in Vega-Lite. Draco's constraints are implemented in based on Answer Set Programming (ASP) and solved with the Clingo constraint solver. We also implemented a way to learn weights for the recommendation system directly from the results of graphical perception experiment.

Read our introductory blog post about Draco and our research paper for more details. Try Draco in the browser at https://uwdata.github.io/draco-editor.

Status

There Be Dragons! This project is in active development and we are working hard on cleaning up the repository and making it easier to use the recommendation model in Draco. If you want to use this right now, please talk to us. More documentation is forthcoming.

Overview

This repository currently contains:

  • The ASP programs with soft and hard constraints.
  • A Python and Typescript API that
    • translates from Compassql and Vega-Lite to ASP: cql2asp, vl2asp
    • translates the output from the Clingo ASP solver to Vega-Lite: asp2vl
    • translates a dataset to schema and ASP declaration: data2schema, schema2asp.
    • translates constraints (hard or soft) from asp to json: constraints2json.

Sibling Repositories

Various functionality and extensions are in the following repositories

  • draco-vis

    • A TypeScript/JavaScript version of Draco for use in web applications.
  • draco-learn

    • Runs a learning-to-rank method on results of perception experiments.
  • draco-tools

    • UI tools to create annotated datasets of pairs of visualizations, look at the recommendations, and to explore large datasets of example visualizations.
  • draco-analysis

    • Notebooks to analyze the results.

Installation

Install Clingo.

You can install Clingo with conda: conda install -c potassco clingo. On MacOS, you can alternatively run brew install clingo.

Install node dependencies

yarn or npm install

You might need to activate a Python 2.7 environment to compile the canvas module.

Build JS module

yarn build

Python setup

pip install -r requirements.txt or conda install --file requirements.txt

Install Draco in editable mode. We expect Python 3.

pip install -e .

Now you can call the command line tool draco. For example draco --version or draco --help.

Tests

You should also be able to run the tests (and coverage report)

python setup.py test

Run only ansunit tests

ansunit asp/tests.yaml

Run only python tests

pytest -v

Test types

mypy draco tests --ignore-missing-imports

Running Draco

End to end example

To run Draco on a partial spec.

sh run_pipeline.sh spec

The output would be a .vl.json file (for Vega-Lite spec) and a .png file to preview the visualization (by default, outputs would be in folder __tmp__).

Use CompassQL to generate examples

Run yarn build_cql_examples.

Run Draco directly on a set of ASP constraints

You can use the helper file asp/_all.lp.

clingo asp/_all.lp test.lp

Alternatively, you can invoke Draco with draco -m asp test.lp.

Run APT example

clingo asp/_apt.lp examples/example_apt.lp --opt-mode=optN --quiet=1 --project -c max_extra_encs=0

This only prints the relevant data and restricts the extra encodings that are being generated.

Releases

  • Make sure everything works!
  • Update __version__ in draco/__init__.py and use the right version below.
  • git commit -m "bump version to 0.0.1"
  • Tag the last commit git tag -a v0.0.1.
  • git push and git push --tags
  • Run python setup.py sdist upload.

Resources

Related Repositories

Previous prototypes

Related software

Guides

draco's People

Contributors

domoritz avatar haldenl avatar mestway avatar light-and-salt avatar ngehlenborg avatar

Watchers

James Cloos avatar

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.