File size: 7,446 Bytes
c500a02
2b3497a
f107edf
 
 
 
 
 
 
58ed0a3
f107edf
ea5c0a1
 
f107edf
 
 
58ed0a3
f107edf
ea5c0a1
 
 
 
 
58ed0a3
ea5c0a1
 
f107edf
 
 
58ed0a3
f107edf
ea5c0a1
f107edf
 
 
58ed0a3
f107edf
ea5c0a1
f107edf
 
 
58ed0a3
f107edf
ea5c0a1
f107edf
 
 
58ed0a3
f107edf
ea5c0a1
f107edf
 
 
58ed0a3
f107edf
ea5c0a1
f107edf
 
 
58ed0a3
f107edf
ea5c0a1
f107edf
 
 
58ed0a3
f107edf
ea5c0a1
f107edf
 
 
 
 
 
e9d79bd
f107edf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d05dc3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213e4d3
137eb5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213e4d3
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import streamlit as st

# Initialize session state for tracking the current lifecycle step
if "step" not in st.session_state:
    st.session_state.step = 0

# Define ML lifecycle steps with detailed descriptions
ml_lifecycle = [
    {
        "title": "📋 **Problem Statement**",
        "description": """
        **Info**:
        Understand the challenge at hand, establish clear objectives, and set criteria for success.
        """
    },
    {
        "title": "🧑‍💻 **Data Collection**",
        "description": """
        **Info**: Gather relevant data to train the model, utilizing sources such as surveys, web scraping, and APIs.
        
        """
    },
     {
        "title": "🔍**Simple EDA**",
        "description": """
        **Info**:  Perform a preliminary analysis to examine the dataset’s key features.
        """
    },
    {
        "title": "🧹 **Data Preprocessing**",
        "description": """
        **Info**: Clean the data to make sure it is in an appropriate format for further analysis.
        """
    },
    {
        "title": "🔎 **EDA**",
        "description": """
        **Info**:Conduct deeper analysis to extract valuable insights and uncover patterns within the data. 
        """
    },
    {
        "title": "🔧 **Feature Engineering**",
        "description": """
        **Info**: Develop new features or refine existing ones to enhance the model’s performance.
        """
    },
    {
        "title": "🛠️ **Training**",
        "description": """
        **Info**:Train machine learning models using the preprocessed data.
        """
    },
    {
        "title": "🧪 **Testing**",
        "description": """
        **Info**:Assess the model’s performance using a separate test dataset to determine its effectiveness.
        """
    },
    {
        "title": "🚀 **Deploying**",
        "description": """
        **Info**:Deploy the trained model into a production environment for real-world use.
        """
    },
    {
        "title": "📊 **Monitoring**",
        "description": """
        **Info**:Continuously track the model’s performance in production to ensure it remains effective over time
        """
    },
]

# Display title and description
st.title("📊 Machine Learning Life Cycle")
st.write("Explore the detailed life cycle of a Machine Learning project by clicking through the steps below:")

# Buttons for navigation
col1, col2, col3 = st.columns([1, 1, 1])
with col1:
    if st.button("⬅️ Previous", disabled=st.session_state.step == 0):
        st.session_state.step -= 1
with col3:
    if st.button("➡️ Next", disabled=st.session_state.step == len(ml_lifecycle) - 1):
        st.session_state.step += 1

# Display the current lifecycle step with details
current_step = ml_lifecycle[st.session_state.step]
st.markdown(f"### {current_step['title']}")
st.markdown(current_step['description'])

# Reset button
if st.button("🔄 Restart"):
    st.session_state.step = 0

# HTML content for shapes and buttons
html_content = """
# Life Cycle of ML

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:

1. **Problem Statement:** Understanding the problem and setting objectives for the ML model.
2. **Data Collection:** Gathering relevant data for model training.
3. **Simple EDA (Exploratory Data Analysis):** Initial analysis to understand the dataset's basic properties.
4. **Data Preprocessing:** Cleaning the data to ensure it's in a usable format.
5. **EDA (Exploratory Data Analysis):** Deeper analysis to gain insights and find patterns in the data.
6. **Feature Engineering:** Creating new features or modifying existing ones to improve model performance.
7. **Training:** Training machine learning models using the processed data.
8. **Testing:** Evaluating the trained model using a test set to assess its performance.
9. **Deploying:** Deploying the model to a production environment.
10. **Monitoring:** Continuously monitoring the model's performance in the production environment.

---

## Shapes Representing the ML Life Cycle

<svg width="800" height="600">
  <!-- Problem Statement (Rectangle) -->
  <rect x="50" y="50" width="150" height="50" fill="#FFB6C1" stroke="#000" />
  <text x="125" y="80" fill="#000" font-size="14" text-anchor="middle">Problem Statement</text>
  
  <!-- Data Collection (Ellipse) -->
  <ellipse cx="300" cy="75" rx="80" ry="40" fill="#ADD8E6" stroke="#000" />
  <text x="300" y="80" fill="#000" font-size="14" text-anchor="middle">Data Collection</text>
  
  <!-- Simple EDA (Ellipse) -->
  <ellipse cx="500" cy="75" rx="80" ry="40" fill="#90EE90" stroke="#000" />
  <text x="500" y="80" fill="#000" font-size="14" text-anchor="middle">Simple EDA</text>
  
  <!-- Arrows between Problem Statement, Data Collection, and Simple EDA -->
  <line x1="200" y1="75" x2="260" y2="75" stroke="#000" marker-end="url(#arrow)" />
  <line x1="380" y1="75" x2="460" y2="75" stroke="#000" marker-end="url(#arrow)" />
  
  <!-- Data Preprocessing (Rectangle) -->
  <rect x="50" y="200" width="150" height="50" fill="#FFD700" stroke="#000" />
  <text x="125" y="230" fill="#000" font-size="14" text-anchor="middle">Data Preprocessing</text>
  
  <!-- EDA (Circle) -->
  <circle cx="300" cy="225" r="40" fill="#FF7F50" stroke="#000" />
  <text x="300" y="230" fill="#000" font-size="14" text-anchor="middle">EDA</text>
  
  <!-- Feature Engineering (Ellipse) -->
  <ellipse cx="500" cy="225" rx="80" ry="40" fill="#9370DB" stroke="#000" />
  <text x="500" y="230" fill="#000" font-size="14" text-anchor="middle">Feature Engineering</text>
  
  <!-- Arrows between Data Preprocessing, EDA, and Feature Engineering -->
  <line x1="125" y1="250" x2="260" y2="225" stroke="#000" marker-end="url(#arrow)" />
  <line x1="380" y1="225" x2="460" y2="225" stroke="#000" marker-end="url(#arrow)" />
  
  <!-- Training (Rectangle) -->
  <rect x="50" y="350" width="150" height="50" fill="#FF6347" stroke="#000" />
  <text x="125" y="380" fill="#000" font-size="14" text-anchor="middle">Training</text>
  
  <!-- Testing (Circle) -->
  <circle cx="300" cy="375" r="40" fill="#98FB98" stroke="#000" />
  <text x="300" y="380" fill="#000" font-size="14" text-anchor="middle">Testing</text>
  
  <!-- Deploying (Ellipse) -->
  <ellipse cx="500" cy="375" rx="80" ry="40" fill="#F0E68C" stroke="#000" />
  <text x="500" y="380" fill="#000" font-size="14" text-anchor="middle">Deploying</text>

<!-- Arrows between Training, Testing, and Deploying -->
  <line x1="125" y1="400" x2="260" y2="375" stroke="#000" marker-end="url(#arrow)" />
  <line x1="380" y1="375" x2="460" y2="375" stroke="#000" marker-end="url(#arrow)" />
  
  <!-- Monitoring (Rectangle) -->
  <rect x="250" y="500" width="150" height="50" fill="#B0E0E6" stroke="#000" />
  <text x="325" y="530" fill="#000" font-size="14" text-anchor="middle">Monitoring</text>
  
  <!-- Arrow from Deploying to Monitoring -->
  <line x1="580" y1="375" x2="325" y2="500" stroke="#000" marker-end="url(#arrow)" />
  
  <!-- Define arrow marker -->
  <defs>
    <marker id="arrow" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="4" markerHeight="4" orient="auto">
      <polygon points="0,0 10,5 0,10" fill="#000" />
    </marker>
  </defs>
</svg>

"""

# Add the HTML content to the streamlit app
st.markdown(html_content, unsafe_allow_html=True)