Spaces:
Sleeping
Sleeping
Update pages/3_Life cycle of ML.py
Browse files- pages/3_Life cycle of ML.py +59 -88
pages/3_Life cycle of ML.py
CHANGED
|
@@ -1,114 +1,85 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
-
# Custom CSS for
|
| 4 |
custom_css = """
|
| 5 |
<style>
|
| 6 |
-
|
| 7 |
-
background: linear-gradient(
|
| 8 |
-
rgba(255, 255, 255, 0.9),
|
| 9 |
-
rgba(200, 200, 255, 0.8)
|
| 10 |
-
),
|
| 11 |
-
url('https://i.imgur.com/vIszbgs.jpeg') no-repeat center center fixed;
|
| 12 |
-
background-size: cover;
|
| 13 |
-
font-family: Arial, sans-serif;
|
| 14 |
-
color: #333333;
|
| 15 |
-
}
|
| 16 |
-
h1 {
|
| 17 |
-
color: #2c3e50;
|
| 18 |
-
text-align: center;
|
| 19 |
-
font-size: 3rem;
|
| 20 |
-
margin-top: 20px;
|
| 21 |
-
text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.8);
|
| 22 |
-
}
|
| 23 |
-
.circle-container {
|
| 24 |
-
display: flex;
|
| 25 |
-
justify-content: center;
|
| 26 |
-
flex-wrap: wrap;
|
| 27 |
-
gap: 20px;
|
| 28 |
-
margin-top: 30px;
|
| 29 |
-
}
|
| 30 |
-
.circle-button {
|
| 31 |
width: 100px;
|
| 32 |
height: 100px;
|
| 33 |
-
border-radius: 50%;
|
| 34 |
background-color: #4CAF50;
|
| 35 |
-
display: flex;
|
| 36 |
-
justify-content: center;
|
| 37 |
-
align-items: center;
|
| 38 |
color: white;
|
| 39 |
-
font-size:
|
|
|
|
|
|
|
|
|
|
| 40 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
| 41 |
cursor: pointer;
|
| 42 |
-
|
| 43 |
}
|
| 44 |
-
.
|
| 45 |
background-color: #45a049;
|
| 46 |
-
transform: scale(1.1);
|
| 47 |
}
|
| 48 |
-
.
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
</style>
|
| 52 |
"""
|
| 53 |
|
| 54 |
-
# Apply CSS
|
| 55 |
st.markdown(custom_css, unsafe_allow_html=True)
|
| 56 |
|
| 57 |
# Title
|
| 58 |
-
st.markdown("<h1>
|
| 59 |
-
st.write("
|
| 60 |
|
| 61 |
-
#
|
| 62 |
-
|
| 63 |
-
"Problem Statement",
|
| 64 |
-
"
|
| 65 |
-
"
|
| 66 |
-
"Data Pre-Processing",
|
| 67 |
-
"EDA",
|
| 68 |
-
"Feature Engineering",
|
| 69 |
-
"Model Training",
|
| 70 |
-
"Testing",
|
| 71 |
-
"Deployment",
|
| 72 |
-
"Maintenance",
|
| 73 |
]
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
"
|
| 78 |
-
"Data
|
| 79 |
-
"
|
| 80 |
-
"
|
| 81 |
-
"
|
| 82 |
-
"
|
| 83 |
-
"
|
| 84 |
-
"
|
| 85 |
-
"Deployment": "Integrate the model into a production environment.",
|
| 86 |
-
"Maintenance": "Monitor and update the model to ensure performance.",
|
| 87 |
}
|
| 88 |
|
| 89 |
-
#
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
for
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
if st.markdown(
|
| 99 |
-
f"""
|
| 100 |
-
<div class="{btn_class}" onclick="window.parent.streamlit.runOnClick({repr(stage)})">
|
| 101 |
-
{stage}
|
| 102 |
-
</div>
|
| 103 |
-
""",
|
| 104 |
-
unsafe_allow_html=True,
|
| 105 |
-
):
|
| 106 |
-
st.session_state.selected_stage = stage
|
| 107 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
| 108 |
|
| 109 |
-
|
| 110 |
-
if st.session_state.selected_stage:
|
| 111 |
-
selected_stage = st.session_state.selected_stage
|
| 112 |
-
st.markdown(f"### {selected_stage}")
|
| 113 |
-
st.write(stage_descriptions[selected_stage])
|
| 114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from graphviz import Digraph
|
| 3 |
|
| 4 |
+
# Custom CSS for circular buttons
|
| 5 |
custom_css = """
|
| 6 |
<style>
|
| 7 |
+
.circular-button {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
width: 100px;
|
| 9 |
height: 100px;
|
|
|
|
| 10 |
background-color: #4CAF50;
|
|
|
|
|
|
|
|
|
|
| 11 |
color: white;
|
| 12 |
+
font-size: 14px;
|
| 13 |
+
font-weight: bold;
|
| 14 |
+
border: none;
|
| 15 |
+
border-radius: 50%;
|
| 16 |
text-align: center;
|
| 17 |
+
line-height: 100px;
|
| 18 |
+
margin: 10px;
|
| 19 |
+
display: inline-block;
|
| 20 |
cursor: pointer;
|
| 21 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
|
| 22 |
}
|
| 23 |
+
.circular-button:hover {
|
| 24 |
background-color: #45a049;
|
|
|
|
| 25 |
}
|
| 26 |
+
.container {
|
| 27 |
+
display: flex;
|
| 28 |
+
justify-content: center;
|
| 29 |
+
align-items: center;
|
| 30 |
+
flex-wrap: wrap;
|
| 31 |
+
}
|
| 32 |
+
.arrow {
|
| 33 |
+
font-size: 24px;
|
| 34 |
+
color: #2c3e50;
|
| 35 |
+
text-align: center;
|
| 36 |
+
margin: 0 15px;
|
| 37 |
}
|
| 38 |
</style>
|
| 39 |
"""
|
| 40 |
|
| 41 |
+
# Apply custom CSS
|
| 42 |
st.markdown(custom_css, unsafe_allow_html=True)
|
| 43 |
|
| 44 |
# Title
|
| 45 |
+
st.markdown("<h1 style='text-align:center;'>Machine Learning Lifecycle</h1>", unsafe_allow_html=True)
|
| 46 |
+
st.write("Explore the 10 steps of the ML lifecycle by clicking on the buttons below.")
|
| 47 |
|
| 48 |
+
# Define lifecycle steps and descriptions
|
| 49 |
+
lifecycle_steps = [
|
| 50 |
+
"Problem Statement", "Data Collection", "Simple EDA", "Data Pre-Processing",
|
| 51 |
+
"EDA", "Feature Engineering", "Model Training", "Testing",
|
| 52 |
+
"Hyperparameter Tuning", "Deployment and Maintenance"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
]
|
| 54 |
+
lifecycle_descriptions = {
|
| 55 |
+
"Problem Statement": "Define the objective of the project.",
|
| 56 |
+
"Data Collection": "Gather data from various sources.",
|
| 57 |
+
"Simple EDA": "Summarize data to understand its quality.",
|
| 58 |
+
"Data Pre-Processing": "Clean data by removing missing or null values.",
|
| 59 |
+
"EDA": "Visualize data and uncover insights.",
|
| 60 |
+
"Feature Engineering": "Create and analyze features and labels.",
|
| 61 |
+
"Model Training": "Train the model to learn feature-label relationships.",
|
| 62 |
+
"Testing": "Evaluate the model's performance.",
|
| 63 |
+
"Hyperparameter Tuning": "Optimize the model for best performance.",
|
| 64 |
+
"Deployment and Maintenance": "Deploy and monitor the model in production."
|
|
|
|
|
|
|
| 65 |
}
|
| 66 |
|
| 67 |
+
# Generate Graphviz Circular Diagram
|
| 68 |
+
def generate_graph():
|
| 69 |
+
dot = Digraph()
|
| 70 |
+
dot.attr(rankdir="LR", size="8,8", layout="circo")
|
| 71 |
+
for i, step in enumerate(lifecycle_steps):
|
| 72 |
+
dot.node(f"{i+1}", step)
|
| 73 |
+
for i in range(len(lifecycle_steps)):
|
| 74 |
+
dot.edge(f"{i+1}", f"{(i+1) % len(lifecycle_steps) + 1}")
|
| 75 |
+
return dot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
st.graphviz_chart(generate_graph(), use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
# Circular interactive buttons for each step
|
| 80 |
+
st.markdown("<div class='container'>", unsafe_allow_html=True)
|
| 81 |
+
for step in lifecycle_steps:
|
| 82 |
+
if st.button(step, key=step):
|
| 83 |
+
st.write(f"### {step}")
|
| 84 |
+
st.write(lifecycle_descriptions[step])
|
| 85 |
+
st.markdown("</div>", unsafe_allow_html=True)
|