Spaces:
Sleeping
Sleeping
hibana2077
commited on
Commit
•
e3b3d38
1
Parent(s):
a34dfff
Add Drop col
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Author: hibana2077 [email protected]
|
3 |
Date: 2024-01-02 21:43:38
|
4 |
LastEditors: hibana2077 [email protected]
|
5 |
-
LastEditTime: 2024-01-
|
6 |
FilePath: \hayabusa\src\main.py
|
7 |
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
8 |
'''
|
@@ -34,7 +34,7 @@ if choice == "Upload":
|
|
34 |
file = st.file_uploader("Upload Your Dataset")
|
35 |
if file:
|
36 |
df = pd.read_csv(file, index_col=None)
|
37 |
-
df.drop("Unnamed: 0", axis=1, inplace=True) if "Unnamed: 0" in df.columns else
|
38 |
df.to_csv('dataset.csv', index=None)
|
39 |
st.dataframe(df)
|
40 |
st.session_state['df'] = df
|
@@ -48,11 +48,12 @@ if choice == "Profiling":
|
|
48 |
if choice == "Modelling":
|
49 |
df:pd.DataFrame = st.session_state['df']
|
50 |
chosen_target = st.selectbox('Choose the Target Column', df.columns)
|
|
|
51 |
ml_task = st.selectbox('Choose the ML Task', ['Classification', 'Regression'])
|
52 |
if st.button('Run Modelling'):
|
53 |
if ml_task == 'Classification':
|
54 |
from pycaret.classification import setup, compare_models, pull, save_model, get_config
|
55 |
-
setup(df, target=chosen_target)
|
56 |
setup_df = pull()
|
57 |
st.dataframe(setup_df)
|
58 |
best_model = compare_models(exclude=['lightgbm'])
|
@@ -67,7 +68,7 @@ if choice == "Modelling":
|
|
67 |
pickle.dump(pipeline, f)
|
68 |
else:
|
69 |
from pycaret.regression import setup, compare_models, pull, save_model
|
70 |
-
setup(df, target=chosen_target)
|
71 |
setup_df = pull()
|
72 |
st.dataframe(setup_df)
|
73 |
best_model = compare_models(exclude=['lightgbm'])
|
|
|
2 |
Author: hibana2077 [email protected]
|
3 |
Date: 2024-01-02 21:43:38
|
4 |
LastEditors: hibana2077 [email protected]
|
5 |
+
LastEditTime: 2024-01-04 22:21:47
|
6 |
FilePath: \hayabusa\src\main.py
|
7 |
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
8 |
'''
|
|
|
34 |
file = st.file_uploader("Upload Your Dataset")
|
35 |
if file:
|
36 |
df = pd.read_csv(file, index_col=None)
|
37 |
+
df.drop("Unnamed: 0", axis=1, inplace=True) if "Unnamed: 0" in df.columns else "No Unnamed: 0 Detected"
|
38 |
df.to_csv('dataset.csv', index=None)
|
39 |
st.dataframe(df)
|
40 |
st.session_state['df'] = df
|
|
|
48 |
if choice == "Modelling":
|
49 |
df:pd.DataFrame = st.session_state['df']
|
50 |
chosen_target = st.selectbox('Choose the Target Column', df.columns)
|
51 |
+
drop_columns = st.multiselect('Choose the Columns to Drop', df.columns)
|
52 |
ml_task = st.selectbox('Choose the ML Task', ['Classification', 'Regression'])
|
53 |
if st.button('Run Modelling'):
|
54 |
if ml_task == 'Classification':
|
55 |
from pycaret.classification import setup, compare_models, pull, save_model, get_config
|
56 |
+
setup(df, target=chosen_target, ignore_features=drop_columns)
|
57 |
setup_df = pull()
|
58 |
st.dataframe(setup_df)
|
59 |
best_model = compare_models(exclude=['lightgbm'])
|
|
|
68 |
pickle.dump(pipeline, f)
|
69 |
else:
|
70 |
from pycaret.regression import setup, compare_models, pull, save_model
|
71 |
+
setup(df, target=chosen_target, ignore_features=drop_columns)
|
72 |
setup_df = pull()
|
73 |
st.dataframe(setup_df)
|
74 |
best_model = compare_models(exclude=['lightgbm'])
|