|
import streamlit as st |
|
from pycaret.regression import * |
|
from pathlib import Path |
|
|
|
path_root = Path(Path.cwd()) |
|
|
|
from pycaret.datasets import get_data |
|
|
|
|
|
st.markdown("# Regression❄️") |
|
with st.sidebar: |
|
st.sidebar.markdown("# Regression Feature ❄️") |
|
evaluation_option = st.selectbox("evaluation", ["residuals", "error", "cooks", "rfe", "learning", "vc", "manifold", "feature", "feature_all", "residuals_interactive", "parameter", "tree"]) |
|
|
|
data = get_data('insurance') |
|
s = setup(data, target = 'charges') |
|
st.markdown("## Compare model") |
|
best = compare_models() |
|
df_metric = pull() |
|
st.dataframe(df_metric) |
|
st.markdown("## Evaluation") |
|
evaluate_model(best) |
|
image_options = {"error": "Prediction Error.png", |
|
"residuals": "Residuals.png", |
|
"cooks": "unknow", |
|
"rfe": "unknow", |
|
"learning": "Learning Curve.png", |
|
"vc": "Validation Curve.png", |
|
"manifold": "Manifold Curve.png", |
|
"feature": "Feature Importance.png", |
|
"feature_all": "Feature Importance (All).png", |
|
"residuals_interactive": "unknow" |
|
} |
|
try: |
|
st.markdown(f"## {evaluation_option}") |
|
plot_model(best, plot = evaluation_option, save = 'images') |
|
st.image(str(path_root.joinpath(f"images/{image_options[evaluation_option]}"))) |
|
except e: |
|
st.text(e) |
|
|