Spaces:
Sleeping
Sleeping
Update pages/Life_cycle_of_ML.py
Browse files- pages/Life_cycle_of_ML.py +71 -87
pages/Life_cycle_of_ML.py
CHANGED
@@ -1,91 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
# HTML content inside a string for correct syntax
|
4 |
-
html_content = """
|
5 |
-
# Life Cycle of ML
|
6 |
-
|
7 |
-
The life cycle of Machine Learning (ML) involves several stages, from defining the problem to deploying and monitoring the model. Here's an overview of each stage:
|
8 |
-
|
9 |
-
1. **Problem Statement:** Understanding the problem and setting objectives for the ML model.
|
10 |
-
2. **Data Collection:** Gathering relevant data for model training.
|
11 |
-
3. **Simple EDA (Exploratory Data Analysis):** Initial analysis to understand the dataset's basic properties.
|
12 |
-
4. **Data Preprocessing:** Cleaning the data to ensure it's in a usable format.
|
13 |
-
5. **EDA (Exploratory Data Analysis):** Deeper analysis to gain insights and find patterns in the data.
|
14 |
-
6. **Feature Engineering:** Creating new features or modifying existing ones to improve model performance.
|
15 |
-
7. **Training:** Training machine learning models using the processed data.
|
16 |
-
8. **Testing:** Evaluating the trained model using a test set to assess its performance.
|
17 |
-
9. **Deploying:** Deploying the model to a production environment.
|
18 |
-
10. **Monitoring:** Continuously monitoring the model's performance in the production environment.
|
19 |
-
|
20 |
-
---
|
21 |
-
|
22 |
-
## Shapes Representing the ML Life Cycle
|
23 |
-
|
24 |
-
<svg width="800" height="600">
|
25 |
-
<!-- Problem Statement (Rectangle) -->
|
26 |
-
<rect x="50" y="50" width="150" height="50" fill="#FFB6C1" stroke="#000" />
|
27 |
-
<text x="125" y="80" fill="#000" font-size="14" text-anchor="middle">Problem Statement</text>
|
28 |
-
|
29 |
-
<!-- Data Collection (Ellipse) -->
|
30 |
-
<ellipse cx="300" cy="75" rx="80" ry="40" fill="#ADD8E6" stroke="#000" />
|
31 |
-
<text x="300" y="80" fill="#000" font-size="14" text-anchor="middle">Data Collection</text>
|
32 |
-
|
33 |
-
<!-- Simple EDA (Ellipse) -->
|
34 |
-
<ellipse cx="500" cy="75" rx="80" ry="40" fill="#90EE90" stroke="#000" />
|
35 |
-
<text x="500" y="80" fill="#000" font-size="14" text-anchor="middle">Simple EDA</text>
|
36 |
-
|
37 |
-
<!-- Arrows between Problem Statement, Data Collection, and Simple EDA -->
|
38 |
-
<line x1="200" y1="75" x2="260" y2="75" stroke="#000" marker-end="url(#arrow)" />
|
39 |
-
<line x1="380" y1="75" x2="460" y2="75" stroke="#000" marker-end="url(#arrow)" />
|
40 |
-
|
41 |
-
<!-- Data Preprocessing (Rectangle) -->
|
42 |
-
<rect x="50" y="200" width="150" height="50" fill="#FFD700" stroke="#000" />
|
43 |
-
<text x="125" y="230" fill="#000" font-size="14" text-anchor="middle">Data Preprocessing</text>
|
44 |
-
|
45 |
-
<!-- EDA (Circle) -->
|
46 |
-
<circle cx="300" cy="225" r="40" fill="#FF7F50" stroke="#000" />
|
47 |
-
<text x="300" y="230" fill="#000" font-size="14" text-anchor="middle">EDA</text>
|
48 |
-
|
49 |
-
<!-- Feature Engineering (Ellipse) -->
|
50 |
-
<ellipse cx="500" cy="225" rx="80" ry="40" fill="#9370DB" stroke="#000" />
|
51 |
-
<text x="500" y="230" fill="#000" font-size="14" text-anchor="middle">Feature Engineering</text>
|
52 |
-
|
53 |
-
<!-- Arrows between Data Preprocessing, EDA, and Feature Engineering -->
|
54 |
-
<line x1="125" y1="250" x2="260" y2="225" stroke="#000" marker-end="url(#arrow)" />
|
55 |
-
<line x1="380" y1="225" x2="460" y2="225" stroke="#000" marker-end="url(#arrow)" />
|
56 |
-
|
57 |
-
<!-- Training (Rectangle) -->
|
58 |
-
<rect x="50" y="350" width="150" height="50" fill="#FF6347" stroke="#000" />
|
59 |
-
<text x="125" y="380" fill="#000" font-size="14" text-anchor="middle">Training</text>
|
60 |
-
|
61 |
-
<!-- Testing (Circle) -->
|
62 |
-
<circle cx="300" cy="375" r="40" fill="#98FB98" stroke="#000" />
|
63 |
-
<text x="300" y="380" fill="#000" font-size="14" text-anchor="middle">Testing</text>
|
64 |
-
|
65 |
-
<!-- Deploying (Ellipse) -->
|
66 |
-
<ellipse cx="500" cy="375" rx="80" ry="40" fill="#F0E68C" stroke="#000" />
|
67 |
-
<text x="500" y="380" fill="#000" font-size="14" text-anchor="middle">Deploying</text>
|
68 |
-
|
69 |
-
<!-- Arrows between Training, Testing, and Deploying -->
|
70 |
-
<line x1="125" y1="400" x2="260" y2="375" stroke="#000" marker-end="url(#arrow)" />
|
71 |
-
<line x1="380" y1="375" x2="460" y2="375" stroke="#000" marker-end="url(#arrow)" />
|
72 |
-
|
73 |
-
<!-- Monitoring (Rectangle) -->
|
74 |
-
<rect x="250" y="500" width="150" height="50" fill="#B0E0E6" stroke="#000" />
|
75 |
-
<text x="325" y="530" fill="#000" font-size="14" text-anchor="middle">Monitoring</text>
|
76 |
-
|
77 |
-
<!-- Arrow from Deploying to Monitoring -->
|
78 |
-
<line x1="580" y1="375" x2="325" y2="500" stroke="#000" marker-end="url(#arrow)" />
|
79 |
-
|
80 |
-
<!-- Define arrow marker -->
|
81 |
-
<defs>
|
82 |
-
<marker id="arrow" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="4" markerHeight="4" orient="auto">
|
83 |
-
<polygon points="0,0 10,5 0,10" fill="#000" />
|
84 |
-
</marker>
|
85 |
-
</defs>
|
86 |
-
</svg>
|
87 |
-
st.markdown(html_content, unsafe_allow_html=True)
|
88 |
-
|
89 |
# Initialize session state for tracking the current lifecycle step
|
90 |
if "step" not in st.session_state:
|
91 |
st.session_state.step = 0
|
@@ -96,12 +10,16 @@ ml_lifecycle = [
|
|
96 |
"title": "1️⃣ **Problem Statement**",
|
97 |
"description": """
|
98 |
**Goal**:
|
|
|
99 |
"""
|
100 |
},
|
101 |
{
|
102 |
"title": "2️⃣ **Data Collection**",
|
103 |
"description": """
|
104 |
**Goal**:
|
|
|
|
|
|
|
105 |
"""
|
106 |
},
|
107 |
{
|
@@ -198,4 +116,70 @@ st.markdown(current_step['description'])
|
|
198 |
|
199 |
# Reset button
|
200 |
if st.button("🔄 Restart"):
|
201 |
-
st.session_state.step = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
# Initialize session state for tracking the current lifecycle step
|
4 |
if "step" not in st.session_state:
|
5 |
st.session_state.step = 0
|
|
|
10 |
"title": "1️⃣ **Problem Statement**",
|
11 |
"description": """
|
12 |
**Goal**:
|
13 |
+
Understand the problem you are trying to solve, define the objectives, and determine the success criteria for the project.
|
14 |
"""
|
15 |
},
|
16 |
{
|
17 |
"title": "2️⃣ **Data Collection**",
|
18 |
"description": """
|
19 |
**Goal**:
|
20 |
+
Collect relevant data to train the model.
|
21 |
+
- Sources: Surveys, web scraping, APIs, etc.
|
22 |
+
- Example: Collecting data from customer interactions on a website.
|
23 |
"""
|
24 |
},
|
25 |
{
|
|
|
116 |
|
117 |
# Reset button
|
118 |
if st.button("🔄 Restart"):
|
119 |
+
st.session_state.step = 0
|
120 |
+
|
121 |
+
# HTML content for shapes and buttons
|
122 |
+
html_content = """
|
123 |
+
# Life Cycle of ML
|
124 |
+
|
125 |
+
The life cycle of Machine Learning (ML) involves several stages, from defining the problem to deploying and monitoring the model. Here's an overview of each stage:
|
126 |
+
|
127 |
+
1. **Problem Statement:** Understanding the problem and setting objectives for the ML model.
|
128 |
+
2. **Data Collection:** Gathering relevant data for model training.
|
129 |
+
3. **Simple EDA (Exploratory Data Analysis):** Initial analysis to understand the dataset's basic properties.
|
130 |
+
4. **Data Preprocessing:** Cleaning the data to ensure it's in a usable format.
|
131 |
+
5. **EDA (Exploratory Data Analysis):** Deeper analysis to gain insights and find patterns in the data.
|
132 |
+
6. **Feature Engineering:** Creating new features or modifying existing ones to improve model performance.
|
133 |
+
7. **Training:** Training machine learning models using the processed data.
|
134 |
+
8. **Testing:** Evaluating the trained model using a test set to assess its performance.
|
135 |
+
9. **Deploying:** Deploying the model to a production environment.
|
136 |
+
10. **Monitoring:** Continuously monitoring the model's performance in the production environment.
|
137 |
+
|
138 |
+
---
|
139 |
+
|
140 |
+
## Shapes Representing the ML Life Cycle
|
141 |
+
|
142 |
+
<svg width="800" height="600">
|
143 |
+
<!-- Problem Statement (Rectangle) -->
|
144 |
+
<rect x="50" y="50" width="150" height="50" fill="#FFB6C1" stroke="#000" />
|
145 |
+
<text x="125" y="80" fill="#000" font-size="14" text-anchor="middle">Problem Statement</text>
|
146 |
+
|
147 |
+
<!-- Data Collection (Ellipse) -->
|
148 |
+
<ellipse cx="300" cy="75" rx="80" ry="40" fill="#ADD8E6" stroke="#000" />
|
149 |
+
<text x="300" y="80" fill="#000" font-size="14" text-anchor="middle">Data Collection</text>
|
150 |
+
|
151 |
+
<!-- Simple EDA (Ellipse) -->
|
152 |
+
<ellipse cx="500" cy="75" rx="80" ry="40" fill="#90EE90" stroke="#000" />
|
153 |
+
<text x="500" y="80" fill="#000" font-size="14" text-anchor="middle">Simple EDA</text>
|
154 |
+
|
155 |
+
<!-- Arrows between Problem Statement, Data Collection, and Simple EDA -->
|
156 |
+
<line x1="200" y1="75" x2="260" y2="75" stroke="#000" marker-end="url(#arrow)" />
|
157 |
+
<line x1="380" y1="75" x2="460" y2="75" stroke="#000" marker-end="url(#arrow)" />
|
158 |
+
|
159 |
+
<!-- Data Preprocessing (Rectangle) -->
|
160 |
+
<rect x="50" y="200" width="150" height="50" fill="#FFD700" stroke="#000" />
|
161 |
+
<text x="125" y="230" fill="#000" font-size="14" text-anchor="middle">Data Preprocessing</text>
|
162 |
+
|
163 |
+
<!-- EDA (Circle) -->
|
164 |
+
<circle cx="300" cy="225" r="40" fill="#FF7F50" stroke="#000" />
|
165 |
+
<text x="300" y="230" fill="#000" font-size="14" text-anchor="middle">EDA</text>
|
166 |
+
|
167 |
+
<!-- Feature Engineering (Ellipse) -->
|
168 |
+
<ellipse cx="500" cy="225" rx="80" ry="40" fill="#9370DB" stroke="#000" />
|
169 |
+
<text x="500" y="230" fill="#000" font-size="14" text-anchor="middle">Feature Engineering</text>
|
170 |
+
|
171 |
+
<!-- Arrows between Data Preprocessing, EDA, and Feature Engineering -->
|
172 |
+
<line x1="125" y1="250" x2="260" y2="225" stroke="#000" marker-end="url(#arrow)" />
|
173 |
+
<line x1="380" y1="225" x2="460" y2="225" stroke="#000" marker-end="url(#arrow)" />
|
174 |
+
|
175 |
+
<!-- Training (Rectangle) -->
|
176 |
+
<rect x="50" y="350" width="150" height="50" fill="#FF6347" stroke="#000" />
|
177 |
+
<text x="125" y="380" fill="#000" font-size="14" text-anchor="middle">Training</text>
|
178 |
+
|
179 |
+
<!-- Testing (Circle) -->
|
180 |
+
<circle cx="300" cy="375" r="40" fill="#98FB98" stroke="#000" />
|
181 |
+
<text x="300" y="380" fill="#000" font-size="14" text-anchor="middle">Testing</text>
|
182 |
+
|
183 |
+
<!-- Deploying (Ellipse) -->
|
184 |
+
<ellipse cx="500" cy="375" rx="80" ry="40" fill="#F0E68C" stroke="#000" />
|
185 |
+
<text x="500" y="380" fill="#000" font-size="14" text-anchor="middle">
|