Display SHAP diagrams with Streamlit Rev

Hi there :slight_smile:

As the Boston Housing set is deprecated for analytical use because of ethical problems, I decided to revisit my very first Streamlit app build years ago. By making a leap in version 0.61 to 1.17 not only the dataset, but also the SDK changed dramatically.

First of all, the new app is a showcase for what Streamlit has grown into. I mean it has aged beyond belief.
Starting from reading in the dataset, using session state all over the place to make sure it runs efficiently on even the smallest of endpoints, it is :

  1. Loading and caching a linear regression model on the California Housing Set (source code in the app)
  2. Loading and caching an XGBoost model(source code in the app, especially check out plot_tree fix)
  3. Loading and caching SHAPvalues and using st_shap container for better visuals (JavaScript)
  4. Loading and caching UMAP embeddings and plotting them in interactive Altair plots (giving it the edge over Bokeh, which is far more beautiful but poorly understandable)
  5. Plotting the geospatial data using plotly, because " all good things are wild and free"

App running on Streamlit share:

Source code:

Hope it is as ever useful to you :slight_smile:

2 Likes

correct link, as i cannot edit the message anymore?

I’ve updated the original post for you – thanks for this app!

thanks :slight_smile: