Spaces:
Build error
Build error
Commit
·
fd591d1
1
Parent(s):
c6de220
life cycle of ml page added
Browse files
pages/03_life_cycle_of_ml_project.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import matplotlib.pyplot as plt
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
def draw_lifecycle_diagram():
|
| 5 |
+
# Labels and colors for the lifecycle phases
|
| 6 |
+
labels = [
|
| 7 |
+
"1. Gathering Data",
|
| 8 |
+
"2. Data Preparation",
|
| 9 |
+
"3. Data Wrangling",
|
| 10 |
+
"4. Analyze Data",
|
| 11 |
+
"5. Train Model",
|
| 12 |
+
"6. Test Model",
|
| 13 |
+
"7. Deployment"
|
| 14 |
+
]
|
| 15 |
+
colors = [
|
| 16 |
+
"#3CB371", "#8FBC8F", "#00CED1", "#1E90FF",
|
| 17 |
+
"#6A5ACD", "#FF8C00", "#DC143C"
|
| 18 |
+
]
|
| 19 |
+
|
| 20 |
+
# Create a figure and axis with equal aspect ratio
|
| 21 |
+
fig, ax = plt.subplots(figsize=(9, 9), subplot_kw={"aspect": "equal"})
|
| 22 |
+
size = 0.3 # Width of the pie sections
|
| 23 |
+
|
| 24 |
+
# Create pie sections for the lifecycle phases
|
| 25 |
+
wedges, _ = ax.pie(
|
| 26 |
+
[1] * len(labels),
|
| 27 |
+
colors=colors,
|
| 28 |
+
radius=1,
|
| 29 |
+
startangle=90,
|
| 30 |
+
wedgeprops=dict(width=size, edgecolor='w')
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
# Add text labels around the circle
|
| 34 |
+
for i, wedge in enumerate(wedges):
|
| 35 |
+
# Calculate the angle for the label placement
|
| 36 |
+
angle = (wedge.theta2 - wedge.theta1) / 2.0 + wedge.theta1
|
| 37 |
+
x = np.cos(np.deg2rad(angle))
|
| 38 |
+
y = np.sin(np.deg2rad(angle))
|
| 39 |
+
|
| 40 |
+
# Add label text
|
| 41 |
+
ax.text(
|
| 42 |
+
1.2 * x, 1.2 * y, labels[i],
|
| 43 |
+
ha="center", va="center", fontsize=10, weight="bold",
|
| 44 |
+
bbox=dict(boxstyle="round,pad=0.3", facecolor=colors[i], edgecolor="w")
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
# Add center text with a descriptive title
|
| 48 |
+
ax.text(
|
| 49 |
+
0, 0, "Machine Learning\nLifecycle",
|
| 50 |
+
ha="center", va="center", fontsize=16, weight="bold", color="black",
|
| 51 |
+
bbox=dict(boxstyle="round,pad=0.5", facecolor="white", edgecolor="black")
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
# Clean up the diagram style
|
| 55 |
+
ax.set(aspect="equal", xticks=[], yticks=[], title="Machine Learning Lifecycle")
|
| 56 |
+
return fig
|
| 57 |
+
|
| 58 |
+
# Save the diagram or display it in Streamlit
|
| 59 |
+
if __name__ == "__main__":
|
| 60 |
+
# Display the diagram
|
| 61 |
+
fig = draw_lifecycle_diagram()
|
| 62 |
+
plt.show()
|