Skip to content
No description, website, or topics provided.
Python Makefile
Branch: master
Clone or download

A Python API for Intelligent Visual Discovery

Build Status PyPI version Documentation Status

Lux is a Python library that makes data science easier by automating certain aspects of the data exploration process. Lux is designed to facilitate faster experimentation with data, even when the user does not have a clear idea of what they are looking for. Lux is integrated with an interactive Jupyter widget that allows users to quickly browse through large collections of data directly within their Jupyter notebooks.

Here are some slides from a recent talk on Lux.

Quick Start

Install the Python Lux API through PyPI:

pip install lux-api

Install the Lux Jupyter widget through npm:

npm i lux-widget


Lux capabilities

Lux provides a suite of capabilities as outlined in the hierarchy above from the most basic (automatic encoding) to the most complex (predictive recommendations).

Automatic Encoding:

Lux is built on the principle that users should always be able to visualize anything they specify, without having to think about how the visualization should look like. Lux automatically determines the mark and channel mappings based on a set of best practices from Tableau. The visualizations are rendered via Altair into Vega-Lite specifications.

    import lux
    # Load a dataset into Lux
    dataset = lux.Dataset("data/car.csv")

    dobj = lux.DataObj(dataset,[lux.Column("Acceleration"),

Specified Visualization

Search Space Enumeration:

Lux implements a set of enumeration logic that generates a visualization collection based on a partially specified query. Users can provide a list or a wildcard to iterate over combinations of filter or attribute values and quickly browse through large numbers of visualizations. The partial specification is inspired by existing work on query languages for visualization languages, including ZQL and CompassQL.

Here, we want to look at how the attributes Weight and Displacement depend on all other dimension variables.

dobj = lux.DataObj(dataset,[lux.Column(["Weight","Displacement"]),lux.Column("?",dataModel="dimension")])

Specified Visualization

Analytics Modules:

Lux comes with a set of analytics capabilities. We can compose multiple DataObjects or DataObjectCollections to perform a specified task.

For example, we can ask which car brands have a time series of Displacement similar to that of Pontiac cars.

    query = lux.DataObj(dataset,[lux.Column("Year",channel="x"),

    dobj = lux.DataObj(dataset,[lux.Column("Year",channel="x"),

    result = dobj.similarPattern(query,topK=5)

Similar Patterns

Predictive Recommendation:

Lux has an extensible logic that determines the appropriate analytics modules to call based on the user’s current state (i.e., the attributes and values they’re interested in). By calling the showMore command, Lux guides users to potential next-steps in their exploration.

In this example, the user is interested in Acceleration and Horsepower, Lux generates three sets of recommendations, organized as separate tabs on the widget.

    dobj = lux.DataObj(dataset,[lux.Column("Acceleration",dataModel="measure"),
    result = dobj.showMore()

Show More Recommendations

The left-hand side of the widget shows the Current View, which corresponds to the attributes that have been selected. On the right, Lux recommends:

  • Enhance: Adds an additional attribute to the current selection
  • Filter: Adds a filter to the current selection, while keeping X and Y fixed
  • Generalize: Removes an attribute to display a more general trend

Manual Installation (dev)

There are two components of Lux: 1) Python Lux API (this repo)and 2) the Jupyter widget frontend (inside lux-widget).

To install the Python Lux API:

pip install --user -r requirements.txt
cd lux/
python install

To install the widget, we need to install webpack:

npm install --save-dev webpack webpack-cli

Then, we can install the Lux Jupyter widget using the custom installation script:

git clone
cd lux-widget/
npm install

For more detailed examples of how to use Lux, check out this demo notebook.

Lux is undergoing active development. Please report any bugs, issues, or requests through Github Issues.

You can’t perform that action at this time.