How to wrap catboost calc feature statistics chart in streamlit?

I am aware catboost gives nice interactive chart for calculated feature statistics using the api model.cal_feature_statistics, I was wondering If we can include this chart in streamlit.

Streamlit has different chart api ( such as streamlit.plotly_chart, streamlit.altair_chart etc, but I was unable to wrap the catboost output plot in streamlit.

Does anybody have idea how to wrap the chart in streamlit.



# Ref:

# imports
import numpy as np
import pandas as pd
import seaborn as sns
import sklearn
from sklearn import datasets
import catboost as cb

import streamlit as st
import streamlit.components.v1 as stc

# load the data
data = datasets.load_boston()
X =
y =
features = data.feature_names

# modelling
model = cb.CatBoostRegressor(verbose=0),y)

# chart
feature_name = 'sqft_living'
dict_stats = model.calc_feature_statistics(X, y, 0) # 0 means first feature

# streamlit
st.header("catboost feature statistics")

Run the app

streamlit run

Hi @bhishanpdl, welcome to the Streamlit community!

I’ve never used catboost before, but you could check if dict_stats has a _repr_html method. If so, then you could use the components.html function in Streamlit to display the results.

1 Like