AutoML / app.py
thov's picture
Update app.py
b2327d1
raw
history blame
1.94 kB
import streamlit as st
from flaml.automl.data import get_output_from_log
import plotly.express as px
from utils import csv_to_featuers_list, pre_process_df, pre_process_features
from autoML import autoML
st.set_page_config(layout="wide")
# add categorical features
# handle missing values with automl (not possible)
with st.sidebar:
st.subheader('Demo Datasets')
demo_but_class = st.button(label="Demo Classification on Wine Rate Dataset")
demo_but_reg = st.button(label="Demo Regression on California House Dataset")
st.subheader('AutoML your Dataset')
csv = st.file_uploader(label='CSV file')
if csv != None:
csv = csv.name
task = st.selectbox(label='Task', options=['Classification', 'Regression'])
if task == 'Classification':
metric_to_minimize_class = st.selectbox(label='Metric to minimize', options=['accuracy', 'f1'])
metric_to_minimize_reg = None
if task == 'Regression':
metric_to_minimize_reg = st.selectbox(label='Metric to minimize', options=['r2', 'mse', 'rmse'])
metric_to_minimize_class = None
if csv:
lst_features = csv_to_featuers_list(csv)
label = st.selectbox(label='Label', options=lst_features)
budget = st.text_area(label='Budget Time', value="5")
start_but = st.button(label='AutoML')
if start_but:
autoML(csv, task, budget, label, metric_to_minimize_class, metric_to_minimize_reg)
if demo_but_class:
autoML(csv='datasets/WineRate.csv',
task='Classification',
budget=budget,
label='quality',
metric_to_minimize_class='accuracy',
metric_to_minimize_reg=None)
if demo_but_reg:
autoML(csv='datasets/house_california.csv',
task='Regression',
budget=budget,
label='median_house_value',
metric_to_minimize_class=None,
metric_to_minimize_reg='r2')