Sathwikchowdary commited on
Commit
59387da
·
verified ·
1 Parent(s): 162448c

Update pages/Life_cycle_of_ML.py

Browse files
Files changed (1) hide show
  1. pages/Life_cycle_of_ML.py +120 -121
pages/Life_cycle_of_ML.py CHANGED
@@ -1,123 +1,122 @@
1
  import streamlit as st
2
 
3
- import streamlit as st
4
- # HTML content inside a string for correct syntax
5
- html_content = """
6
- # Life Cycle of ML
7
-
8
- 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:
9
-
10
- 1. **Problem Statement:** Understanding the problem and setting objectives for the ML model.
11
- 2. **Data Collection:** Gathering relevant data for model training.
12
- 3. **Simple EDA (Exploratory Data Analysis):** Initial analysis to understand the dataset's basic properties.
13
- 4. **Data Preprocessing:** Cleaning the data to ensure it's in a usable format.
14
- 5. **EDA (Exploratory Data Analysis):** Deeper analysis to gain insights and find patterns in the data.
15
- 6. **Feature Engineering:** Creating new features or modifying existing ones to improve model performance.
16
- 7. **Training:** Training machine learning models using the processed data.
17
- 8. **Testing:** Evaluating the trained model using a test set to assess its performance.
18
- 9. **Deploying:** Deploying the model to a production environment.
19
- 10. **Monitoring:** Continuously monitoring the model's performance in the production environment.
20
-
21
- ---
22
-
23
- ## Shapes Representing the ML Life Cycle
24
-
25
- <svg width="800" height="600">
26
- <!-- Problem Statement (Rectangle) -->
27
- <rect x="50" y="50" width="150" height="50" fill="#FFB6C1" stroke="#000" />
28
- <text x="125" y="80" fill="#000" font-size="14" text-anchor="middle">Problem Statement</text>
29
-
30
- <!-- Data Collection (Ellipse) -->
31
- <ellipse cx="300" cy="75" rx="80" ry="40" fill="#ADD8E6" stroke="#000" />
32
- <text x="300" y="80" fill="#000" font-size="14" text-anchor="middle">Data Collection</text>
33
-
34
- <!-- Simple EDA (Ellipse) -->
35
- <ellipse cx="500" cy="75" rx="80" ry="40" fill="#90EE90" stroke="#000" />
36
- <text x="500" y="80" fill="#000" font-size="14" text-anchor="middle">Simple EDA</text>
37
-
38
- <!-- Arrows between Problem Statement, Data Collection, and Simple EDA -->
39
- <line x1="200" y1="75" x2="260" y2="75" stroke="#000" marker-end="url(#arrow)" />
40
- <line x1="380" y1="75" x2="460" y2="75" stroke="#000" marker-end="url(#arrow)" />
41
-
42
- <!-- Data Preprocessing (Rectangle) -->
43
- <rect x="50" y="200" width="150" height="50" fill="#FFD700" stroke="#000" />
44
- <text x="125" y="230" fill="#000" font-size="14" text-anchor="middle">Data Preprocessing</text>
45
-
46
- <!-- EDA (Circle) -->
47
- <circle cx="300" cy="225" r="40" fill="#FF7F50" stroke="#000" />
48
- <text x="300" y="230" fill="#000" font-size="14" text-anchor="middle">EDA</text>
49
-
50
- <!-- Feature Engineering (Ellipse) -->
51
- <ellipse cx="500" cy="225" rx="80" ry="40" fill="#9370DB" stroke="#000" />
52
- <text x="500" y="230" fill="#000" font-size="14" text-anchor="middle">Feature Engineering</text>
53
-
54
- <!-- Arrows between Data Preprocessing, EDA, and Feature Engineering -->
55
- <line x1="125" y1="250" x2="260" y2="225" stroke="#000" marker-end="url(#arrow)" />
56
- <line x1="380" y1="225" x2="460" y2="225" stroke="#000" marker-end="url(#arrow)" />
57
-
58
- <!-- Training (Rectangle) -->
59
- <rect x="50" y="350" width="150" height="50" fill="#FF6347" stroke="#000" />
60
- <text x="125" y="380" fill="#000" font-size="14" text-anchor="middle">Training</text>
61
-
62
- <!-- Testing (Circle) -->
63
- <circle cx="300" cy="375" r="40" fill="#98FB98" stroke="#000" />
64
- <text x="300" y="380" fill="#000" font-size="14" text-anchor="middle">Testing</text>
65
-
66
- <!-- Deploying (Ellipse) -->
67
- <ellipse cx="500" cy="375" rx="80" ry="40" fill="#F0E68C" stroke="#000" />
68
- <text x="500" y="380" fill="#000" font-size="14" text-anchor="middle">Deploying</text>
69
-
70
- <!-- Arrows between Training, Testing, and Deploying -->
71
- <line x1="125" y1="400" x2="260" y2="375" stroke="#000" marker-end="url(#arrow)" />
72
- <line x1="380" y1="375" x2="460" y2="375" stroke="#000" marker-end="url(#arrow)" />
73
-
74
- <!-- Monitoring (Rectangle) -->
75
- <rect x="250" y="500" width="150" height="50" fill="#B0E0E6" stroke="#000" />
76
- <text x="325" y="530" fill="#000" font-size="14" text-anchor="middle">Monitoring</text>
77
-
78
- <!-- Arrow from Deploying to Monitoring -->
79
- <line x1="580" y1="375" x2="325" y2="500" stroke="#000" marker-end="url(#arrow)" />
80
-
81
- <!-- Define arrow marker -->
82
- <defs>
83
- <marker id="arrow" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="4" markerHeight="4" orient="auto">
84
- <polygon points="0,0 10,5 0,10" fill="#000" />
85
- </marker>
86
- </defs>
87
- </svg>
88
-
89
- <!-- Buttons below shapes -->
90
-
91
- <!-- Problem Statement Button (Rectangle) -->
92
- <button style="width: 150px; height: 50px; background-color: #FFB6C1; border: 1px solid #000; text-align: center;">Problem Statement</button>
93
-
94
- <!-- Data Collection Button (Ellipse) -->
95
- <button style="width: 160px; height: 80px; background-color: #ADD8E6; border-radius: 40px; border: 1px solid #000; text-align: center;">Data Collection</button>
96
-
97
- <!-- Simple EDA Button (Ellipse) -->
98
- <button style="width: 160px; height: 80px; background-color: #90EE90; border-radius: 40px; border: 1px solid #000; text-align: center;">Simple EDA</button>
99
-
100
- <!-- Data Preprocessing Button (Rectangle) -->
101
- <button style="width: 150px; height: 50px; background-color: #FFD700; border: 1px solid #000; text-align: center;">Data Preprocessing</button>
102
-
103
- <!-- EDA Button (Circle) -->
104
- <button style="width: 80px; height: 80px; background-color: #FF7F50; border-radius: 50%; border: 1px solid #000; text-align: center;">EDA</button>
105
-
106
- <!-- Feature Engineering Button (Ellipse) -->
107
- <button style="width: 160px; height: 80px; background-color: #9370DB; border-radius: 40px; border: 1px solid #000; text-align: center;">Feature Engineering</button>
108
-
109
- <!-- Training Button (Rectangle) -->
110
- <button style="width: 150px; height: 50px; background-color: #FF6347; border: 1px solid #000; text-align: center;">Training</button>
111
-
112
- <!-- Testing Button (Circle) -->
113
- <button style="width: 80px; height: 80px; background-color: #98FB98; border-radius: 50%; border: 1px solid #000; text-align: center;">Testing</button>
114
-
115
- <!-- Deploying Button (Ellipse) -->
116
- <button style="width: 160px; height: 80px; background-color: #F0E68C; border-radius: 40px; border: 1px solid #000; text-align: center;">Deploying</button>
117
-
118
- <!-- Monitoring Button (Rectangle) -->
119
- <button style="width: 150px; height: 50px; background-color: #B0E0E6; border: 1px solid #000; text-align: center;">Monitoring</button>
120
- """
121
-
122
- # Render HTML content in Streamlit
123
- st.markdown(html_content, unsafe_allow_html=True)
 
1
  import streamlit as st
2
 
3
+ # Function to display lifecycle descriptions
4
+ def display_lifecycle_stage(stage_name, description):
5
+ st.subheader(stage_name)
6
+ st.write(description)
7
+
8
+ # Page Title
9
+ st.title("Machine Learning Life Cycle")
10
+
11
+ # Markdown Diagram
12
+ st.markdown(
13
+ """
14
+ ```
15
+ +-----------------------+
16
+ | Problem Statement |
17
+ +-----------------------+
18
+ |
19
+ v
20
+ +-----------------------+
21
+ | Data Collection |
22
+ +-----------------------+
23
+ |
24
+ v
25
+ +-----------------------+
26
+ | Simple EDA |
27
+ +-----------------------+
28
+ |
29
+ v
30
+ +-----------------------+
31
+ | Data Preprocessing |
32
+ +-----------------------+
33
+ |
34
+ v
35
+ +-----------------------+
36
+ | EDA |
37
+ +-----------------------+
38
+ |
39
+ v
40
+ +-----------------------+
41
+ | Feature Engineering |
42
+ +-----------------------+
43
+ |
44
+ v
45
+ +-----------------------+
46
+ | Training |
47
+ +-----------------------+
48
+ |
49
+ v
50
+ +-----------------------+
51
+ | Testing |
52
+ +-----------------------+
53
+ |
54
+ v
55
+ +-----------------------+
56
+ | Deployment |
57
+ +-----------------------+
58
+ |
59
+ v
60
+ +-----------------------+
61
+ | Monitoring |
62
+ +-----------------------+
63
+ ```
64
+ """
65
+ )
66
+
67
+ # Buttons for each stage
68
+ col1, col2 = st.columns(2)
69
+
70
+ with col1:
71
+ if st.button("Problem Statement"):
72
+ display_lifecycle_stage(
73
+ "Problem Statement",
74
+ "Defining the problem and setting objectives for the machine learning project.",
75
+ )
76
+ if st.button("Simple EDA"):
77
+ display_lifecycle_stage(
78
+ "Simple EDA",
79
+ "Performing initial exploratory data analysis to understand data distribution and trends.",
80
+ )
81
+ if st.button("EDA"):
82
+ display_lifecycle_stage(
83
+ "EDA",
84
+ "Detailed exploratory data analysis for deeper insights into data patterns.",
85
+ )
86
+ if st.button("Training"):
87
+ display_lifecycle_stage(
88
+ "Training",
89
+ "Fitting the model using the training dataset to learn patterns and relationships.",
90
+ )
91
+ if st.button("Deployment"):
92
+ display_lifecycle_stage(
93
+ "Deployment",
94
+ "Deploying the trained model to production for real-world use.",
95
+ )
96
+
97
+ with col2:
98
+ if st.button("Data Collection"):
99
+ display_lifecycle_stage(
100
+ "Data Collection",
101
+ "Gathering the data required for the machine learning project.",
102
+ )
103
+ if st.button("Data Preprocessing"):
104
+ display_lifecycle_stage(
105
+ "Data Preprocessing",
106
+ "Cleaning and transforming the data to prepare it for analysis.",
107
+ )
108
+ if st.button("Feature Engineering"):
109
+ display_lifecycle_stage(
110
+ "Feature Engineering",
111
+ "Creating new features or modifying existing ones to improve model performance.",
112
+ )
113
+ if st.button("Testing"):
114
+ display_lifecycle_stage(
115
+ "Testing",
116
+ "Evaluating the model's performance using a separate testing dataset.",
117
+ )
118
+ if st.button("Monitoring"):
119
+ display_lifecycle_stage(
120
+ "Monitoring",
121
+ "Monitoring the deployed model's performance and maintaining its accuracy.",
122
+ )