Harika22 commited on
Commit
cf5d161
·
verified ·
1 Parent(s): 9503f35

Update pages/3_Life cycle of ML.py

Browse files
Files changed (1) hide show
  1. pages/3_Life cycle of ML.py +68 -60
pages/3_Life cycle of ML.py CHANGED
@@ -1,85 +1,93 @@
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)
 
1
  import streamlit as st
2
  from graphviz import Digraph
3
 
 
4
  custom_css = """
5
  <style>
6
+ html, body, [data-testid="stAppViewContainer"] {
7
+ background: linear-gradient(to right, #f8fbff, #eef2f3);
8
+ font-family: 'Arial', sans-serif;
9
+ color: #333;
10
+ }
11
+ h1 {
12
+ color: #34495e;
13
+ text-align: center;
14
+ font-size: 2.8rem;
15
+ margin-top: 20px;
16
+ text-shadow: 1px 1px 3px rgba(200, 200, 255, 0.8);
17
+ }
18
+ .stButton button {
19
  background-color: #4CAF50;
 
 
 
20
  border: none;
21
+ color: white;
22
+ padding: 12px 24px;
23
  text-align: center;
24
+ font-size: 16px;
25
+ border-radius: 8px;
 
26
  cursor: pointer;
27
+ transition: background-color 0.3s ease, transform 0.3s ease;
28
  }
29
+ .stButton button:hover {
30
  background-color: #45a049;
31
+ transform: scale(1.05);
32
  }
33
+ .stMarkdown {
 
 
 
 
 
 
 
 
34
  text-align: center;
35
+ margin-top: 10px;
36
  }
37
  </style>
38
  """
39
 
 
40
  st.markdown(custom_css, unsafe_allow_html=True)
41
 
42
+ st.markdown("<h1>🚀 Lifecycle of an ML Project</h1>", unsafe_allow_html=True)
43
+
44
+ st.markdown("<p style='text-align:center;'>Explore each phase of the ML lifecycle by clicking on the buttons below</p>", unsafe_allow_html=True)
45
 
46
+ steps = [
47
+ "Problem Statement",
48
+ "Data Collection",
49
+ "Simple EDA",
50
+ "Data Pre-Processing",
51
+ "EDA",
52
+ "Feature Engineering",
53
+ "Model Training",
54
+ "Testing",
55
+ "Deployment and Maintenance"
56
  ]
57
+
58
+ descriptions = {
59
+ "Problem Statement": "Objective of the project.",
60
+ "Data Collection": "Collecting data from various sources.",
61
+ "Simple EDA": "Describing the quality of the data.",
62
+ "Data Pre-Processing": "It is a technique by which we can convert raw data into pre-procesed data --->1.Clean the data 2.Transform the data",
63
+ "EDA": "Transforming insights into a clean dataset and providing proper visualizations.",
64
+ "Feature Engineering": "Creating and analyzing features and labels.",
65
+ "Model Training": "Training the machine about relationships between features and labels.",
66
+ "Testing": "Testing how efficiently the machine learned.",
67
+ "Deployment and Maintenance": "Deploying the machine to the client and ensuring maintenance for accurate results."
68
  }
69
 
 
 
 
 
 
 
 
 
 
70
 
71
+ graph = Digraph(engine="neato", format="svg")
72
+ graph.attr(splines="true", nodesep="0.8", ranksep="1.2", rankdir="LR")
73
+ graph.attr("node", shape="ellipse", style="filled", color="#b3cde0", fontname="Arial", fontsize="12")
74
+
75
+
76
+ for i, step in enumerate(steps):
77
+ graph.node(str(i), step)
78
+ if i < len(steps) - 1:
79
+ graph.edge(str(i), str(i+1), color="#34495e", penwidth="2", arrowhead="vee", arrowsize="1.2")
80
+
81
+ st.graphviz_chart(graph)
82
+
83
+ st.markdown("<hr>", unsafe_allow_html=True)
84
+
85
+ selected_step = None
86
+ for step in steps:
87
+ if st.button(step):
88
+ selected_step = step
89
+ break
90
 
91
+ if selected_step:
92
+ st.markdown(f"<h2>{selected_step}</h2>", unsafe_allow_html=True)
93
+ st.markdown(f"<p style='font-size:1.1rem; text-align:center;'>{descriptions[selected_step]}</p>", unsafe_allow_html=True)