Harika22 commited on
Commit
d2becc6
Β·
verified Β·
1 Parent(s): 06af333

Update pages/3_Life cycle of ML.py

Browse files
Files changed (1) hide show
  1. pages/3_Life cycle of ML.py +49 -83
pages/3_Life cycle of ML.py CHANGED
@@ -1,84 +1,50 @@
1
  import streamlit as st
2
-
3
- # Initialize session state for navigation
4
- if "page" not in st.session_state:
5
- st.session_state.page = "main"
6
-
7
- def navigate_to(page_name):
8
- st.session_state.page = page_name
9
-
10
- # Main page
11
- if st.session_state.page == "main":
12
- st.markdown(
13
- """
14
- <div style="background-color: #f0f0f5; padding: 15px; border-radius: 10px; text-align: center;">
15
- <h2 style="color: #4a90e2; font-family: Arial, sans-serif;">Machine Learning Project Life Cycle</h2>
16
- </div>
17
- """,
18
- unsafe_allow_html=True
19
- )
20
-
21
- # Circular visualization of ML lifecycle
22
- html_code = """
23
- <div style="display: flex; justify-content: center; align-items: center; height: auto;">
24
- <div style="position: relative; width: 350px; height: 350px; border: 3px solid #4a90e2; border-radius: 50%;">
25
- <div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center;">
26
- <h4 style="color: #4a90e2;">ML Steps</h4>
27
- </div>
28
- <div style="position: absolute; top: 10%; left: 50%; transform: translate(-50%, -50%);">
29
- <div style="background-color: #ff5733; color: white; padding: 8px 15px; border-radius: 5px; text-align: center;">
30
- 1. Problem Statement
31
- </div>
32
- </div>
33
- <div style="position: absolute; top: 30%; left: 85%; transform: translate(-50%, -50%);">
34
- <div style="background-color: #33b5ff; color: white; padding: 8px 15px; border-radius: 5px; text-align: center;">
35
- 2. Data Collection
36
- </div>
37
- </div>
38
- <div style="position: absolute; top: 70%; left: 85%; transform: translate(-50%, -50%);">
39
- <div style="background-color: #33ff57; color: white; padding: 8px 15px; border-radius: 5px; text-align: center;">
40
- 3. Simple EDA
41
- </div>
42
- </div>
43
- <div style="position: absolute; top: 90%; left: 50%; transform: translate(-50%, -50%);">
44
- <div style="background-color: #ff33cc; color: white; padding: 8px 15px; border-radius: 5px; text-align: center;">
45
- 4. Data Pre-Processing
46
- </div>
47
- </div>
48
- <div style="position: absolute; top: 70%; left: 15%; transform: translate(-50%, -50%);">
49
- <div style="background-color: #ffcc33; color: white; padding: 8px 15px; border-radius: 5px; text-align: center;">
50
- 5. EDA
51
- </div>
52
- </div>
53
- <div style="position: absolute; top: 30%; left: 15%; transform: translate(-50%, -50%);">
54
- <div style="background-color: #33ccff; color: white; padding: 8px 15px; border-radius: 5px; text-align: center;">
55
- 6. Feature Engineering
56
- </div>
57
- </div>
58
- <div style="position: absolute; top: 10%; left: 50%; transform: translate(-50%, -50%);">
59
- <div style="background-color: #ff33a1; color: white; padding: 8px 15px; border-radius: 5px; text-align: center;">
60
- 7. Training the Model
61
- </div>
62
- </div>
63
- </div>
64
- </div>
65
- """
66
-
67
- st.markdown(html_code, unsafe_allow_html=True)
68
-
69
- # Descriptions for each step
70
- descriptions = {
71
- "1. Problem Statement": "**Define the aim or goal of your ML model.**",
72
- "2. Data Collection": "**Gather data from various sources like APIs, web scraping, etc.**",
73
- "3. Simple EDA": "**Explore data for missing values and outliers.**",
74
- "4. Data Pre-Processing": "**Clean and transform the data.**",
75
- "5. EDA": "**Gain deeper insights and visualize the data.**",
76
- "6. Feature Engineering": "**Create new features for better model performance.**",
77
- "7. Training the Model": "**Train your model using the prepared dataset.**"
78
- }
79
-
80
- step = st.selectbox("Select a step in the ML lifecycle to learn more:", list(descriptions.keys()))
81
- st.write(descriptions[step])
82
-
83
- if st.button("Learn More About Data Collection"):
84
- navigate_to("data_collection")
 
1
  import streamlit as st
2
+ from PIL import Image
3
+
4
+ def main():
5
+ # Set up the app title and layout
6
+ st.set_page_config(page_title="ML Lifecycle", layout="wide")
7
+
8
+ # Header section with title and subtitle
9
+ st.title("πŸš€ Machine Learning Lifecycle: 10 Steps")
10
+ st.markdown("### A visually engaging journey through the ML lifecycle")
11
+
12
+ # Step descriptions and icons
13
+ steps = [
14
+ {"title": "1. Problem Definition", "description": "Define the problem, goals, and success criteria.", "icon": "πŸ”"},
15
+ {"title": "2. Data Collection", "description": "Gather data from various sources.", "icon": "πŸ“Š"},
16
+ {"title": "3. Data Cleaning", "description": "Handle missing values, remove duplicates, and fix errors.", "icon": "🧹"},
17
+ {"title": "4. Exploratory Data Analysis (EDA)", "description": "Understand data patterns and relationships.", "icon": "πŸ“ˆ"},
18
+ {"title": "5. Feature Engineering", "description": "Create, transform, or select important features.", "icon": "πŸ› οΈ"},
19
+ {"title": "6. Model Selection", "description": "Choose a suitable algorithm for the task.", "icon": "πŸ€–"},
20
+ {"title": "7. Model Training", "description": "Train the model using the training dataset.", "icon": "🎯"},
21
+ {"title": "8. Model Evaluation", "description": "Assess the model's performance using metrics.", "icon": "πŸ“‹"},
22
+ {"title": "9. Deployment", "description": "Deploy the model for real-world use.", "icon": "🌐"},
23
+ {"title": "10. Monitoring & Maintenance", "description": "Monitor the model and update as needed.", "icon": "πŸ“‘"}
24
+ ]
25
+
26
+ # Sidebar with navigation
27
+ st.sidebar.title("Navigate the Lifecycle")
28
+ selected_step = st.sidebar.radio("Steps", [step['title'] for step in steps])
29
+
30
+ # Display the selected step's details
31
+ for step in steps:
32
+ if step['title'] == selected_step:
33
+ st.subheader(f"{step['icon']} {step['title']}")
34
+ st.markdown(step['description'])
35
+
36
+ # Full timeline view
37
+ st.markdown("### Full Timeline")
38
+ cols = st.columns(10)
39
+
40
+ for idx, step in enumerate(steps):
41
+ with cols[idx]:
42
+ st.markdown(f"{step['icon']} **{step['title']}**")
43
+
44
+ # Footer section with images or a final message
45
+ st.markdown("---")
46
+ st.markdown("**Tip:** The ML lifecycle is iterative; revisit steps as needed!")
47
+ st.image("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Machine_learning_lifecycle_diagram.jpg/1200px-Machine_learning_lifecycle_diagram.jpg", caption="Machine Learning Lifecycle", use_column_width=True)
48
+
49
+ if __name__ == "__main__":
50
+ main()