Spaces:
Runtime error
Runtime error
harikrishnad1997
commited on
Upload 3 files
Browse files- app.py +79 -0
- dataset.csv +63 -0
- requirements.txt +157 -0
app.py
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from operator import index
|
2 |
+
import streamlit as st
|
3 |
+
import plotly.express as px
|
4 |
+
import numpy as np
|
5 |
+
from pycaret.regression import setup, compare_models, pull, save_model, load_model, plot_model
|
6 |
+
# from lazypredict.Supervised import LazyRegressor
|
7 |
+
# from sklearn.model_selection import train_test_split
|
8 |
+
from pandas_profiling import ProfileReport
|
9 |
+
import pandas as pd
|
10 |
+
from streamlit_pandas_profiling import st_profile_report
|
11 |
+
import os
|
12 |
+
|
13 |
+
@st.cache
|
14 |
+
def load_data():
|
15 |
+
return pd.read_csv('dataset.csv', index_col=None)
|
16 |
+
|
17 |
+
# Rest of your code...
|
18 |
+
|
19 |
+
if os.path.exists('./dataset.csv'):
|
20 |
+
df = load_data()
|
21 |
+
|
22 |
+
with st.sidebar:
|
23 |
+
st.image("https://michael-fuchs-python.netlify.app/post/2022-01-01-automl-using-pycaret-classification_files/p133s1.png")
|
24 |
+
st.title("AutoML")
|
25 |
+
choice = st.radio("Navigation", ["Upload","Profiling","Modelling", "Download"])
|
26 |
+
st.info("This project application helps you build and explore your data.")
|
27 |
+
|
28 |
+
if choice == "Upload":
|
29 |
+
st.title("Upload Your Dataset")
|
30 |
+
file = st.file_uploader("Upload Your Dataset")
|
31 |
+
if file:
|
32 |
+
df = pd.read_csv(file, index_col=None)
|
33 |
+
df.to_csv('dataset.csv', index=None)
|
34 |
+
st.dataframe(df)
|
35 |
+
|
36 |
+
if choice == "Profiling":
|
37 |
+
st.title("Exploratory Data Analysis")
|
38 |
+
profile_df = df.profile_report()
|
39 |
+
st_profile_report(profile_df)
|
40 |
+
|
41 |
+
if choice == "Modelling":
|
42 |
+
chosen_target = st.selectbox('Choose the Target Column', df.columns)
|
43 |
+
if st.button('Run Modelling'):
|
44 |
+
print("WIP")
|
45 |
+
# h2o.init()
|
46 |
+
# df = h2o.import_file(df)
|
47 |
+
# df.describe(chunk_summary=True)
|
48 |
+
# train, test = df.split_frame(ratios=[0.8], seed = 1)
|
49 |
+
# aml = H2OAutoML(max_models =25,
|
50 |
+
# balance_classes=True,
|
51 |
+
# seed =16548846)
|
52 |
+
# aml.train(training_frame = train, y = 'y')
|
53 |
+
# lb = aml.leaderboard
|
54 |
+
# lb.head(rows=lb.nrows)
|
55 |
+
# aml.train(training_frame = train, y = 'y', leaderboard_frame = my_leaderboard_frame)
|
56 |
+
# best_model = aml.get_best_model()
|
57 |
+
# model_path = h2o.save_model(model=best_model,force=True)
|
58 |
+
setup(df.dropna(subset=chosen_target), target=chosen_target, session_id = 2774764,imputation_type = 'simple',numeric_imputation='mean',categorical_imputation='mode')
|
59 |
+
setup_df = pull()
|
60 |
+
st.dataframe(setup_df)
|
61 |
+
best_model = compare_models(n_select = 5)
|
62 |
+
compare_df = pull()
|
63 |
+
st.dataframe(compare_df)
|
64 |
+
plot_model(best_model, plot='residuals', display_format='streamlit')
|
65 |
+
plot_model(best_model, plot='feature', display_format='streamlit')
|
66 |
+
plot_model(best_model, plot='error', display_format='streamlit')
|
67 |
+
save_model(best_model, 'best_model')
|
68 |
+
# y = df[chosen_target]
|
69 |
+
# X = df.loc[:, df.columns!=chosen_target]
|
70 |
+
# X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=.5,random_state =65481254)
|
71 |
+
# reg = LazyRegressor(verbose=0,ignore_warnings=False, custom_metric=None )
|
72 |
+
# models,predictions = reg.fit(X_train, X_test, y_train, y_test)
|
73 |
+
# st.dataframe(models)
|
74 |
+
# model_dictionary = reg.provide_models(X_train,X_test,y_train,y_test)
|
75 |
+
|
76 |
+
if choice == "Download":
|
77 |
+
print("Working")
|
78 |
+
with open('best_model.pkl', 'rb') as f:
|
79 |
+
st.download_button('Download Model', f, file_name="best_model.pkl")
|
dataset.csv
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Fruit,Form,RetailPrice,RetailPriceUnit,Yield,CupEquivalentSize,CupEquivalentUnit,CupEquivalentPrice
|
2 |
+
Apples,Fresh,1.5193,per pound,0.9,0.2425,pounds,0.4094
|
3 |
+
"Apples, applesauce",Canned,1.066,per pound,1,0.5401,pounds,0.5758
|
4 |
+
"Apples, ready-to-drink",Juice,0.7804,per pint,1,8,fluid ounces,0.3902
|
5 |
+
"Apples, frozen concentrate",Juice,0.5853,per pint,1,8,fluid ounces,0.2926
|
6 |
+
Apricots,Fresh,2.9665,per pound,0.93,0.3638,pounds,1.1603
|
7 |
+
"Apricots, packed in juice",Canned,1.6905,per pound,1,0.5401,pounds,0.9131
|
8 |
+
"Apricots, packed in syrup or water",Canned,2.06,per pound,0.65,0.4409,pounds,1.3974
|
9 |
+
Apricots,Dried,6.6188,per pound,1,0.1433,pounds,0.9485
|
10 |
+
Bananas,Fresh,0.5249,per pound,0.64,0.3307,pounds,0.2712
|
11 |
+
"Berries, mixed",Frozen,3.5585,per pound,1,0.3307,pounds,1.1768
|
12 |
+
Blackberries,Fresh,6.0172,per pound,0.96,0.3197,pounds,2.0037
|
13 |
+
Blackberries,Frozen,3.6362,per pound,1,0.3307,pounds,1.2025
|
14 |
+
Blueberries,Fresh,4.1739,per pound,0.95,0.3197,pounds,1.4045
|
15 |
+
Blueberries,Frozen,3.3898,per pound,1,0.3307,pounds,1.121
|
16 |
+
Cantaloupe,Fresh,0.5767,per pound,0.51,0.3748,pounds,0.4238
|
17 |
+
Cherries,Fresh,3.4269,per pound,0.92,0.3417,pounds,1.2729
|
18 |
+
"Cherries, packed in syrup or water",Canned,4.5257,per pound,0.65,0.4409,pounds,3.07
|
19 |
+
Clementines,Fresh,1.3847,per pound,0.77,0.463,pounds,0.8326
|
20 |
+
Cranberries,Dried,4.6513,per pound,1,0.1232,pounds,0.5729
|
21 |
+
Dates,Dried,5.5713,per pound,1,0.1653,pounds,0.9212
|
22 |
+
Figs,Dried,6.8371,per pound,0.96,0.1653,pounds,1.1776
|
23 |
+
"Fruit cocktail, packed in juice",Canned,1.7198,per pound,1,0.5401,pounds,0.9289
|
24 |
+
"Fruit cocktail, packed in syrup or water",Canned,1.5932,per pound,0.65,0.4409,pounds,1.0808
|
25 |
+
Grapefruit,Fresh,1.1695,per pound,0.49,0.463,pounds,1.105
|
26 |
+
"Grapefruit, ready-to-drink",Juice,1.0415,per pint,1,8,fluid ounces,0.5208
|
27 |
+
Grapes,Fresh,1.8398,per pound,0.96,0.3307,pounds,0.6338
|
28 |
+
Grapes (raisins),Dried,3.7801,per pound,1,0.1653,pounds,0.625
|
29 |
+
"Grapes, ready-to-drink",Juice,0.9215,per pint,1,8,fluid ounces,0.4607
|
30 |
+
"Grapes, frozen concentrate",Juice,0.7119,per pint,1,8,fluid ounces,0.3559
|
31 |
+
Honeydew,Fresh,0.9056,per pound,0.46,0.3748,pounds,0.7378
|
32 |
+
Kiwi,Fresh,2.1849,per pound,0.76,0.3858,pounds,1.1091
|
33 |
+
Mangoes,Fresh,1.1513,per pound,0.71,0.3638,pounds,0.5898
|
34 |
+
Mangoes,Dried,10.5527,per pound,1,0.1253,pounds,1.3219
|
35 |
+
Nectarines,Fresh,1.9062,per pound,0.91,0.3197,pounds,0.6696
|
36 |
+
Oranges,Fresh,1.2131,per pound,0.68,0.4079,pounds,0.7276
|
37 |
+
"Oranges, ready-to-drink",Juice,0.9842,per pint,1,8,fluid ounces,0.4921
|
38 |
+
"Oranges, frozen concentrate",Juice,0.769,per pint,1,8,fluid ounces,0.3845
|
39 |
+
Papaya,Fresh,1.2904,per pound,0.62,0.3086,pounds,0.6424
|
40 |
+
Papaya,Dried,5.5089,per pound,1,0.1543,pounds,0.8502
|
41 |
+
Peaches,Fresh,1.7167,per pound,0.96,0.3417,pounds,0.6111
|
42 |
+
"Peaches, packed in juice",Canned,2.0237,per pound,1,0.5401,pounds,1.0931
|
43 |
+
"Peaches, packed in syrup or water",Canned,1.8117,per pound,0.65,0.4409,pounds,1.229
|
44 |
+
Peaches,Frozen,3.3867,per pound,1,0.3307,pounds,1.12
|
45 |
+
Pears,Fresh,1.5865,per pound,0.9,0.3638,pounds,0.6412
|
46 |
+
"Pears, packed in juice",Canned,1.9546,per pound,1,0.5401,pounds,1.0557
|
47 |
+
"Pears, packed in syrup or water",Canned,1.897,per pound,0.65,0.4409,pounds,1.2868
|
48 |
+
Pineapple,Fresh,0.5685,per pound,0.51,0.3638,pounds,0.4055
|
49 |
+
"Pineapple, packed in juice",Canned,1.4344,per pound,1,0.5401,pounds,0.7748
|
50 |
+
"Pineapple, packed in syrup or water",Canned,1.4067,per pound,0.65,0.4409,pounds,0.9543
|
51 |
+
Pineapple,Dried,6.6492,per pound,1,0.1543,pounds,1.0261
|
52 |
+
"Pineapple, ready-to-drink",Juice,1.0288,per pint,1,8,fluid ounces,0.5144
|
53 |
+
"Pineapple, frozen concentrate",Juice,0.6973,per pint,1,8,fluid ounces,0.3486
|
54 |
+
Plum,Fresh,2.0292,per pound,0.94,0.3638,pounds,0.7852
|
55 |
+
Plum (prunes),Dried,5.7042,per pound,1,0.1874,pounds,1.0689
|
56 |
+
"Plum (prune), ready-to-drink",Juice,1.5522,per pint,1,8,fluid ounces,0.7761
|
57 |
+
Pomegranate,Fresh,2.235,per pound,0.56,0.3417,pounds,1.3638
|
58 |
+
"Pomegranate, ready-to-drink",Juice,3.122,per pint,1,8,fluid ounces,1.561
|
59 |
+
Raspberries,Fresh,6.6391,per pound,0.96,0.3197,pounds,2.2107
|
60 |
+
Raspberries,Frozen,4.1877,per pound,1,0.3307,pounds,1.3849
|
61 |
+
Strawberries,Fresh,2.58,per pound,0.94,0.3197,pounds,0.8774
|
62 |
+
Strawberries,Frozen,2.8189,per pound,1,0.3307,pounds,0.9322
|
63 |
+
Watermelon,Fresh,0.3604,per pound,0.52,0.3307,pounds,0.2292
|
requirements.txt
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# alembic==1.8.1
|
2 |
+
# altair==4.2.0
|
3 |
+
# asttokens==2.0.8
|
4 |
+
# attrs==22.1.0
|
5 |
+
# backcall==0.2.0
|
6 |
+
# blinker==1.5
|
7 |
+
# blis==0.7.9
|
8 |
+
# Boruta==0.3
|
9 |
+
# cachetools==5.2.0
|
10 |
+
# catalogue==1.0.2
|
11 |
+
# certifi==2022.9.24
|
12 |
+
# charset-normalizer==2.1.1
|
13 |
+
# click==8.1.3
|
14 |
+
# cloudpickle==2.2.0
|
15 |
+
# colorama==0.4.6
|
16 |
+
# colorlover==0.3.0
|
17 |
+
# commonmark==0.9.1
|
18 |
+
# cufflinks==0.17.3
|
19 |
+
# cycler==0.11.0
|
20 |
+
# cymem==2.0.7
|
21 |
+
# databricks-cli==0.17.3
|
22 |
+
# debugpy==1.6.3
|
23 |
+
django
|
24 |
+
# decorator==5.1.1
|
25 |
+
# docker==6.0.0
|
26 |
+
# entrypoints==0.4
|
27 |
+
# executing==1.1.1
|
28 |
+
# Flask==2.2.2
|
29 |
+
# fonttools==4.38.0
|
30 |
+
# funcy==1.17
|
31 |
+
# future==0.18.2
|
32 |
+
# gensim==3.8.3
|
33 |
+
# gitdb==4.0.9
|
34 |
+
# GitPython==3.1.29
|
35 |
+
# greenlet==1.1.3.post0
|
36 |
+
# htmlmin==0.1.12
|
37 |
+
# idna==3.4
|
38 |
+
# ImageHash==4.3.1
|
39 |
+
# imbalanced-learn==0.7.0
|
40 |
+
# importlib-metadata==5.0.0
|
41 |
+
# ipykernel==6.16.2
|
42 |
+
ipython
|
43 |
+
# ipywidgets==8.0.2
|
44 |
+
# itsdangerous==2.1.2
|
45 |
+
# jedi==0.18.1
|
46 |
+
# Jinja2==3.1.2
|
47 |
+
# joblib==1.2.0
|
48 |
+
# jsonschema==4.16.0
|
49 |
+
# jupyter_client==7.4.4
|
50 |
+
# jupyter_core==4.11.2
|
51 |
+
# jupyterlab-widgets==3.0.3
|
52 |
+
# kiwisolver==1.4.4
|
53 |
+
# kmodes==0.12.2
|
54 |
+
# lightgbm==3.3.3
|
55 |
+
# llvmlite==0.37.0
|
56 |
+
lazypredict
|
57 |
+
# Mako==1.2.3
|
58 |
+
# MarkupSafe==2.1.1
|
59 |
+
matplotlib
|
60 |
+
matplotlib-inline
|
61 |
+
# missingno==0.5.1
|
62 |
+
# mlflow==1.30.0
|
63 |
+
# mlxtend==0.19.0
|
64 |
+
# multimethod==1.9
|
65 |
+
# murmurhash==1.0.9
|
66 |
+
# nest-asyncio==1.5.6
|
67 |
+
# networkx==2.8.7
|
68 |
+
# nltk==3.7
|
69 |
+
# numba==0.54.1
|
70 |
+
# numexpr==2.8.3
|
71 |
+
numpy
|
72 |
+
# oauthlib==3.2.2
|
73 |
+
# packaging==21.3
|
74 |
+
pandas
|
75 |
+
pandas-profiling
|
76 |
+
# parso==0.8.3
|
77 |
+
# patsy==0.5.3
|
78 |
+
# phik==0.12.2
|
79 |
+
# pickleshare==0.7.5
|
80 |
+
# pickle5
|
81 |
+
# Pillow==9.2.0
|
82 |
+
# plac==1.1.3
|
83 |
+
plotly
|
84 |
+
# preshed==3.0.8
|
85 |
+
# prometheus-client==0.15.0
|
86 |
+
# prometheus-flask-exporter==0.20.3
|
87 |
+
# prompt-toolkit==3.0.31
|
88 |
+
# protobuf==3.20.3
|
89 |
+
# psutil==5.9.3
|
90 |
+
# pure-eval==0.2.2
|
91 |
+
# pyarrow==9.0.0
|
92 |
+
pycaret[full]
|
93 |
+
# pydantic==1.10.2
|
94 |
+
# pydeck==0.8.0b4
|
95 |
+
# Pygments==2.13.0
|
96 |
+
# PyJWT==2.6.0
|
97 |
+
# pyLDAvis==3.3.1
|
98 |
+
# Pympler==1.0.1
|
99 |
+
# pynndescent==0.5.7
|
100 |
+
# pyod==1.0.6
|
101 |
+
# pyparsing==3.0.9
|
102 |
+
# pyrsistent==0.18.1
|
103 |
+
python-dateutil
|
104 |
+
pytz
|
105 |
+
# pytz-deprecation-shim==0.1.0.post0
|
106 |
+
# pywin32==304
|
107 |
+
# PyYAML==5.4.1
|
108 |
+
# pyzmq==24.0.1
|
109 |
+
# querystring-parser==1.2.4
|
110 |
+
# regex==2022.9.13
|
111 |
+
requests
|
112 |
+
# rich==12.6.0
|
113 |
+
scikit-learn
|
114 |
+
scikit-plot
|
115 |
+
scipy
|
116 |
+
# seaborn
|
117 |
+
# semver==2.13.0
|
118 |
+
# six==1.16.0
|
119 |
+
# sklearn
|
120 |
+
# smart-open==6.2.0
|
121 |
+
# smmap==5.0.0
|
122 |
+
# spacy==2.3.8
|
123 |
+
# SQLAlchemy==1.4.42
|
124 |
+
# sqlparse==0.4.3
|
125 |
+
# srsly==1.0.6
|
126 |
+
# stack-data==0.5.1
|
127 |
+
statsmodels
|
128 |
+
streamlit
|
129 |
+
streamlit-pandas-profiling
|
130 |
+
# tabulate==0.9.0
|
131 |
+
# tangled-up-in-unicode==0.2.0
|
132 |
+
# tenacity==8.1.0
|
133 |
+
# textblob==0.17.1
|
134 |
+
# thinc==7.4.6
|
135 |
+
# threadpoolctl==3.1.0
|
136 |
+
# toml==0.10.2
|
137 |
+
# toolz==0.12.0
|
138 |
+
# tornado==6.2
|
139 |
+
# tqdm==4.64.1
|
140 |
+
# traitlets==5.5.0
|
141 |
+
# typing_extensions==4.4.0
|
142 |
+
# tzdata==2022.5
|
143 |
+
# tzlocal==4.2
|
144 |
+
# umap-learn==0.5.3
|
145 |
+
# urllib3==1.26.12
|
146 |
+
# validators==0.20.0
|
147 |
+
# visions==0.7.5
|
148 |
+
# waitress==2.1.2
|
149 |
+
# wasabi==0.10.1
|
150 |
+
# watchdog==2.1.9
|
151 |
+
# wcwidth==0.2.5
|
152 |
+
# websocket-client==1.4.1
|
153 |
+
# Werkzeug==2.2.2
|
154 |
+
# widgetsnbextension==4.0.3
|
155 |
+
# wordcloud==1.8.2.2
|
156 |
+
# yellowbrick==1.2.1
|
157 |
+
# zipp==3.10.0
|