Théo Villette
commited on
Commit
•
c507785
1
Parent(s):
e390497
add pipeline
Browse files
app.py
CHANGED
@@ -1,9 +1,8 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
-
from utils import csv_to_featuers_list
|
4 |
from autoML import autoML
|
5 |
|
6 |
-
|
7 |
st.set_page_config(layout="wide")
|
8 |
|
9 |
# add categorical features
|
@@ -19,9 +18,7 @@ with st.sidebar:
|
|
19 |
|
20 |
st.subheader('AutoML your Dataset')
|
21 |
|
22 |
-
csv = st.file_uploader(label='CSV file')
|
23 |
-
if csv != None:
|
24 |
-
csv = csv.name
|
25 |
|
26 |
task = st.selectbox(label='Task', options=['Classification', 'Regression'])
|
27 |
|
@@ -33,7 +30,9 @@ with st.sidebar:
|
|
33 |
metric_to_minimize_class = None
|
34 |
|
35 |
if csv:
|
36 |
-
|
|
|
|
|
37 |
label = st.selectbox(label='Label', options=lst_features)
|
38 |
|
39 |
budget = st.text_area(label='Budget Time', value="5")
|
@@ -42,7 +41,7 @@ with st.sidebar:
|
|
42 |
|
43 |
if start_but:
|
44 |
|
45 |
-
autoML(csv, task, budget, label, metric_to_minimize_class, metric_to_minimize_reg)
|
46 |
|
47 |
|
48 |
if demo_but_class:
|
|
|
1 |
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
|
|
|
4 |
from autoML import autoML
|
5 |
|
|
|
6 |
st.set_page_config(layout="wide")
|
7 |
|
8 |
# add categorical features
|
|
|
18 |
|
19 |
st.subheader('AutoML your Dataset')
|
20 |
|
21 |
+
csv = st.file_uploader(label='CSV file', type='csv')
|
|
|
|
|
22 |
|
23 |
task = st.selectbox(label='Task', options=['Classification', 'Regression'])
|
24 |
|
|
|
30 |
metric_to_minimize_class = None
|
31 |
|
32 |
if csv:
|
33 |
+
df = pd.read_csv(csv)
|
34 |
+
df.to_csv('datasets/temp_file.csv', index=False)
|
35 |
+
lst_features = df.columns
|
36 |
label = st.selectbox(label='Label', options=lst_features)
|
37 |
|
38 |
budget = st.text_area(label='Budget Time', value="5")
|
|
|
41 |
|
42 |
if start_but:
|
43 |
|
44 |
+
autoML('datasets/temp_file.csv', task, budget, label, metric_to_minimize_class, metric_to_minimize_reg)
|
45 |
|
46 |
|
47 |
if demo_but_class:
|
autoML.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
import numpy as np
|
@@ -20,6 +21,7 @@ def autoML(csv, task, budget, label, metric_to_minimize_class, metric_to_minimiz
|
|
20 |
time.sleep(0.5)
|
21 |
|
22 |
df = pd.read_csv(csv)
|
|
|
23 |
df_features = df[df.columns.difference([label])]
|
24 |
y = df[label]
|
25 |
|
@@ -144,7 +146,11 @@ def autoML(csv, task, budget, label, metric_to_minimize_class, metric_to_minimiz
|
|
144 |
'features importance': perm_importance["importances_mean"],
|
145 |
'std error': perm_importance["importances_std"]})
|
146 |
|
147 |
-
fig_features = px.bar(df_features_importance,
|
|
|
|
|
|
|
|
|
148 |
|
149 |
st.divider()
|
150 |
st.plotly_chart(fig_features, theme="streamlit")
|
@@ -155,4 +161,7 @@ def autoML(csv, task, budget, label, metric_to_minimize_class, metric_to_minimiz
|
|
155 |
href = f'<a href="data:file/output_model;base64,{b64}" download="automl.pkl">Download Trained Model File (.pkl)</a>'
|
156 |
st.markdown(href, unsafe_allow_html=True)
|
157 |
|
158 |
-
download_model(automl)
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
import streamlit as st
|
3 |
import pandas as pd
|
4 |
import numpy as np
|
|
|
21 |
time.sleep(0.5)
|
22 |
|
23 |
df = pd.read_csv(csv)
|
24 |
+
print(df)
|
25 |
df_features = df[df.columns.difference([label])]
|
26 |
y = df[label]
|
27 |
|
|
|
146 |
'features importance': perm_importance["importances_mean"],
|
147 |
'std error': perm_importance["importances_std"]})
|
148 |
|
149 |
+
fig_features = px.bar(df_features_importance,
|
150 |
+
x='features importance',
|
151 |
+
y='features name',
|
152 |
+
error_x='std error',
|
153 |
+
height=50*len(df_features_importance))
|
154 |
|
155 |
st.divider()
|
156 |
st.plotly_chart(fig_features, theme="streamlit")
|
|
|
161 |
href = f'<a href="data:file/output_model;base64,{b64}" download="automl.pkl">Download Trained Model File (.pkl)</a>'
|
162 |
st.markdown(href, unsafe_allow_html=True)
|
163 |
|
164 |
+
download_model(automl)
|
165 |
+
|
166 |
+
if os.path.isfile('datasets/temp_file.csv'):
|
167 |
+
os.remove('datasets/temp_file.csv')
|