Neptune-Altair IntegrationΒΆ

This integration lets you log interactive charts generated in altair, like confusion matrix or distribution, in Neptune.

altair neptune.ai integration

Follow these steps:

  1. Create an experiment:

    import neptune
    
    neptune.init(api_token='ANONYMOUS',project_qualified_name='shared/showroom')
    neptune.create_experiment()
    
  2. Create and log altair charts into Neptune:

    import altair as alt
    from vega_datasets import data
    
    source = data.cars()
    
    brush = alt.selection(type='interval')
    
    points = alt.Chart(source).mark_point().encode(
        x='Horsepower:Q',
        y='Miles_per_Gallon:Q',
        color=alt.condition(brush, 'Origin:N', alt.value('lightgray'))
    ).add_selection(
        brush
    )
    
    bars = alt.Chart(source).mark_bar().encode(
        y='Origin:N',
        color='Origin:N',
        x='count(Origin):Q'
    ).transform_filter(
        brush
    )
    
    chart = points & bars
    
    from neptunecontrib.api import log_chart
    
    log_chart(name='altair_chart', chart=chart)
    
  3. Explore the results in the Neptune dashboard:

Check out this experiment in the app.

image