A Python API for Intelligent Data Discovery
Project description
A Python API for Intelligent Visual Discovery
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.
Features
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"),
lux.Column("Horsepower")])
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")])
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"),
lux.Column("Displacement",channel="y"),
lux.Row("Brand","pontiac")])
dobj = lux.DataObj(dataset,[lux.Column("Year",channel="x"),
lux.Column("Displacement",channel="y"),
lux.Row("Brand","?")])
result = dobj.similarPattern(query,topK=5)
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"),
lux.Column("Horsepower",dataModel="measure")])
result = dobj.showMore()
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
Installation
There are two components of Lux: 1) Python Lux API (inside lux/
)and 2) the jupyter widget frontend (inside widget/
).
To install the Python Lux API:
pip install --user -r requirements.txt
cd lux/
python setup.py install
To install the widget, we need to install webpack:
npm install --save-dev webpack webpack-cli
Then, we can install the jupyter widget using the custom installation script:
cd widget/
npm install
sh install.sh
For more detailed examples of how to use Lux, check out this demo notebook.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.