Spaces:
Configuration error
Configuration error
Commit
·
fe160e9
1
Parent(s):
d81b645
Delete deployment
Browse files- deployment/__pycache__/eda.cpython-311.pyc +0 -0
- deployment/__pycache__/model.cpython-311.pyc +0 -0
- deployment/app.py +0 -38
- deployment/distribution_.cost.png +0 -0
- deployment/eda.py +0 -42
- deployment/heatmap.png +0 -0
- deployment/histogram_customer_rating.png +0 -0
- deployment/model.pkl +0 -3
- deployment/model.py +0 -57
- deployment/requirements.txt +0 -5
deployment/__pycache__/eda.cpython-311.pyc
DELETED
Binary file (3.66 kB)
|
|
deployment/__pycache__/model.cpython-311.pyc
DELETED
Binary file (3.14 kB)
|
|
deployment/app.py
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
Milestone 2
|
3 |
-
Nama: Devin Yaung Lee
|
4 |
-
Batch: HCK-009
|
5 |
-
program ini untuk mendeploy model
|
6 |
-
"""
|
7 |
-
|
8 |
-
import streamlit as st
|
9 |
-
import eda
|
10 |
-
import model
|
11 |
-
|
12 |
-
page = st.sidebar.selectbox(label="Select Page:", options=["Home Page", "Exploratory Data Analysis", "Predict On Time"])
|
13 |
-
|
14 |
-
if page == "Home Page":
|
15 |
-
st.title("Home Page")
|
16 |
-
st.write('')
|
17 |
-
st.write("Milestone 2")
|
18 |
-
st.write("Name : Devin Yaung Lee")
|
19 |
-
st.write("Batch : HCK-009")
|
20 |
-
st.write("Aplikasi ini memiliki tujuan utama untuk menampilkan hasil untuk memprediksi apakah pengiriman product berdasarkan parameter-parameter tententu, pengiriman on time atau tidak.")
|
21 |
-
st.write('')
|
22 |
-
st.write('')
|
23 |
-
st.write('')
|
24 |
-
|
25 |
-
with st.expander("Background Information"):
|
26 |
-
st.caption("Dataset ini membahas tentang E-Commerce Shipping Data. Dimana data ini membahas tentang bagaimana proses pegiriman data yang berbeda-beda, dimana ada jalur darat, jalur laut, dan jalur udara. Dari ketiga hal ini akan dilihat juga bagaimana rating dari tiap-tiap proses jalur, dan tujuan utama pembuatan model ini adalah untuk mengetahui apakah dari parameter-parameter column ini, pengiriman on time atau tidak.")
|
27 |
-
with st.expander("Conclusion"):
|
28 |
-
st.caption("""
|
29 |
-
- Didapatkan bahwa pada saat melalakukan pengecheckan nilai skewness, column prior_purchases dan discount_offered didapatkan bahwa nilai skewness pada column tersebut mengalami skew, hal ini kemungkinan dikarenakan terdapat outliers pada kedua columns tersebut. Maka perlu dilakukan handling outliers. Pada kasus ini jika tidak ingin menghilangkan data, maka handling outliers yang paling cocok adalah dengan menggunakan winsorizer yang nanti akan dilakukan di proses selanjutnya.
|
30 |
-
- Berdasarkan dari hasil visualisasi didapatkan bahwa ada keterdapatan outliers pada beberapa column tertentu, dan dilakukan handling outliers menggunakan winsorizer
|
31 |
-
- Berdasarkan dari analisa model, dari baseline model, hyperparameter tuning, dan boosting, didapatkan bahwa model terbaik adalah menggunakan model SVM.
|
32 |
-
""")
|
33 |
-
|
34 |
-
elif page == "Exploratory Data Analysis":
|
35 |
-
eda.run() # Calls the run function from eda
|
36 |
-
|
37 |
-
else:
|
38 |
-
model.run() # Calls the run function from model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deployment/distribution_.cost.png
DELETED
Binary file (29.1 kB)
|
|
deployment/eda.py
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
Milestone 2
|
3 |
-
Nama: Devin Yaung Lee
|
4 |
-
Batch: HCK-009
|
5 |
-
// eda.py //
|
6 |
-
program ini untuk mendeploy model EDA interface.
|
7 |
-
"""
|
8 |
-
|
9 |
-
import streamlit as st
|
10 |
-
import pandas as pd
|
11 |
-
|
12 |
-
# Function to run in app.py
|
13 |
-
def run():
|
14 |
-
st.title("Explatoratory Data Analysis")
|
15 |
-
|
16 |
-
df = pd.read_csv("../Train.csv")
|
17 |
-
|
18 |
-
# The first 5 data
|
19 |
-
st.header("The first 5 data entry")
|
20 |
-
st.table(df.head(5))
|
21 |
-
|
22 |
-
# The last 5 data
|
23 |
-
st.header("The last 5 data entry")
|
24 |
-
st.table(df.tail(5))
|
25 |
-
|
26 |
-
# Heatmap correlation
|
27 |
-
st.header("Correlation heatmap")
|
28 |
-
st.image("heatmap.png", caption="Figure 1")
|
29 |
-
with st.expander("Explanation"):
|
30 |
-
st.caption("Berdasarkan dari hasil ini dapat dikatakan ada beberapa column yang memiliki korelasi. Ada beberapa column yang memiliki korelasi sampai 30% - 40%, dan ada juga korelasi minus yang dapat dikatakan bahwa column tersebut tidak memiliki atau hampir tidak memiliki korelasi satu sama lain")
|
31 |
-
|
32 |
-
# Histogram Distribution of Customer Rating
|
33 |
-
st.header("Histogram Distribution of Customer Rating")
|
34 |
-
st.image("histogram_customer_rating.png", caption="Figure 2")
|
35 |
-
with st.expander("Explanation"):
|
36 |
-
st.caption("Berdasarkan dari hasil data histogram, didapatkan bahwa persebaran nilai customer rating memiliki persebaran yang relatif sama besar. Hal ini ada beberapa kemungkinan data ini terbagi rata untuk pada saat data entry. Dan jika dilihat secara detail, didapatkan nilai tertinggi persebaran/distribusinya adalah rating 1 dan rating 3. Besar kemungkinan pada proses shipping ini sering terjadi problem yang membuat customer tidak merasa puas dengan pelayanan shippingnya.")
|
37 |
-
|
38 |
-
# Distribution of Cost of the Product
|
39 |
-
st.header("Distribution of Cost of the Product")
|
40 |
-
st.image("distribution_.cost.png", caption="Figure 4")
|
41 |
-
with st.expander("Explanation"):
|
42 |
-
st.caption("> Berdasarkan dari hasil diatas didapatkan bahwa distribusi untuk cost of the product rata-rata berada dikisaran harga $250, hal ini dapat dikatakan bahwa besarnya biaya per product ini dapat dikarenakan biaya pengiriman yang mahal ataupun jarak tempuh pengiriman")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deployment/heatmap.png
DELETED
Binary file (89.9 kB)
|
|
deployment/histogram_customer_rating.png
DELETED
Binary file (26 kB)
|
|
deployment/model.pkl
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:588a1d3936d2e9030fd98160cb7350361245a0248bc54603fccd25891fa78257
|
3 |
-
size 994350
|
|
|
|
|
|
|
|
deployment/model.py
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
Milestone 2
|
3 |
-
Nama: Devin Yaung Lee
|
4 |
-
Batch: HCK-009
|
5 |
-
// eda.py //
|
6 |
-
program ini menjadi base model EDA interface.
|
7 |
-
"""
|
8 |
-
import streamlit as st
|
9 |
-
import pandas as pd
|
10 |
-
import pickle
|
11 |
-
|
12 |
-
import streamlit as st
|
13 |
-
import pandas as pd
|
14 |
-
import pickle
|
15 |
-
|
16 |
-
def run():
|
17 |
-
st.title("Predict the Shipping On Time")
|
18 |
-
with open('model.pkl', 'rb') as file:
|
19 |
-
full_process = pickle.load(file)
|
20 |
-
|
21 |
-
# Collecting user input
|
22 |
-
warehouse_block = st.selectbox('Warehouse Block', ['A', 'B', 'C', 'D', 'E'])
|
23 |
-
mode_of_shipment = st.selectbox('Mode of Shipment', ['Flight', 'Ship', 'Road'])
|
24 |
-
customer_care_calls = st.selectbox('Customer Care Calls', [1, 2, 3, 4, 5, 6, 7])
|
25 |
-
customer_rating = st.selectbox('Customer Rating', [1, 2, 3, 4, 5])
|
26 |
-
cost_of_the_product = st.number_input('Cost of the Product (in USD)', min_value=0)
|
27 |
-
prior_purchases = st.selectbox('Prior Purchases', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
28 |
-
product_importance = st.selectbox('Product Importance', ['low', 'medium', 'high'])
|
29 |
-
gender = st.selectbox('Gender', ['F', 'M'])
|
30 |
-
discount_offered = st.number_input('Discount Offered (in %)', min_value=0)
|
31 |
-
weight_in_gms = st.number_input('Weight (in grams)', min_value=0)
|
32 |
-
|
33 |
-
# Creating a DataFrame with the user input
|
34 |
-
data_inf = pd.DataFrame({
|
35 |
-
'warehouse_block': [warehouse_block],
|
36 |
-
'mode_of_shipment': [mode_of_shipment],
|
37 |
-
'customer_care_calls': [customer_care_calls],
|
38 |
-
'customer_rating': [customer_rating],
|
39 |
-
'cost_of_the_product': [cost_of_the_product],
|
40 |
-
'prior_purchases': [prior_purchases],
|
41 |
-
'product_importance': [product_importance],
|
42 |
-
'gender': [gender],
|
43 |
-
'discount_offered': [discount_offered],
|
44 |
-
'weight_in_gms': [weight_in_gms]
|
45 |
-
})
|
46 |
-
|
47 |
-
st.write('Review your input:')
|
48 |
-
st.table(data_inf)
|
49 |
-
|
50 |
-
if st.button('Predict'):
|
51 |
-
# Make prediction
|
52 |
-
prediction = full_process.predict(data_inf)
|
53 |
-
if prediction == 0:
|
54 |
-
st.success("The model predicts the shipment will not be on time!")
|
55 |
-
else:
|
56 |
-
st.success("The model predicts the shipment will be on time!")
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deployment/requirements.txt
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
pandas
|
2 |
-
numpy
|
3 |
-
scikit-learn
|
4 |
-
matplotlib
|
5 |
-
seaborn
|
|
|
|
|
|
|
|
|
|
|
|