File size: 4,567 Bytes
fdfcd02
53da5ec
 
1d136fa
c94158d
53da5ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de2e517
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53da5ec
 
 
 
 
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
import streamlit as st
from graphviz import Digraph
import time
import random

# Define the emoji to use for the swim lanes
SWIM_LANES = {
    "Data Pipelines": "๐Ÿ”",
    "Build and Train Models": "๐Ÿงช",
    "Deploy and Predict": "๐Ÿš€"
}

# Define the graph structure
graph = Digraph()
graph.attr(rankdir="TB") # Top to Bottom or LR Left to Right
graph.attr(fontsize="20")
graph.attr(compound="true")
graph.attr(nodesep="0.5")

# Define the nodes
graph.node("๐Ÿ“Š Data Collection")
graph.node("๐Ÿงน Data Cleaning")
graph.node("๐Ÿ”ง Data Transformation")
graph.node("๐Ÿ”Ž Feature Engineering")
graph.node("โš™๏ธ Model Selection")
graph.node("๐ŸŽ“ Model Training")
graph.node("๐Ÿšข Model Deployment")
graph.node("๐Ÿ“ก Model Serving")
graph.node("๐Ÿ”ฎ Predictions")
graph.node("๐Ÿ‘ Feedback Collection")
graph.node("๐Ÿค” Feedback Processing")
graph.node("โœ๏ธ Model Updating")

# Add the edges
graph.edge("๐Ÿ“Š Data Collection", "๐Ÿงน Data Cleaning")
graph.edge("๐Ÿงน Data Cleaning", "๐Ÿ”ง Data Transformation")
graph.edge("๐Ÿ”ง Data Transformation", "๐Ÿ”Ž Feature Engineering")
graph.edge("๐Ÿ”Ž Feature Engineering", "โš™๏ธ Model Selection")
graph.edge("โš™๏ธ Model Selection", "๐ŸŽ“ Model Training")
graph.edge("๐ŸŽ“ Model Training", "๐Ÿšข Model Deployment")
graph.edge("๐Ÿšข Model Deployment", "๐Ÿ“ก Model Serving")
graph.edge("๐Ÿ“ก Model Serving", "๐Ÿ”ฎ Predictions")
graph.edge("๐Ÿ”ฎ Predictions", "๐Ÿ‘ Feedback Collection")
graph.edge("๐Ÿ‘ Feedback Collection", "๐Ÿค” Feedback Processing")
graph.edge("๐Ÿค” Feedback Processing", "โœ๏ธ Model Updating")
graph.edge("โœ๏ธ Model Updating", "๐ŸŽ“ Model Training")

# Add the swim lanes
with graph.subgraph(name="cluster_0") as c:
    c.attr(rank="1")
    c.attr(label=SWIM_LANES["Data Pipelines"])
    c.edge("๐Ÿ“Š Data Collection", "๐Ÿงน Data Cleaning", style="invis")
    c.edge("๐Ÿงน Data Cleaning", "๐Ÿ”ง Data Transformation", style="invis")

with graph.subgraph(name="cluster_1") as c:
    c.attr(rank="2")
    c.attr(label=SWIM_LANES["Build and Train Models"])
    c.edge("๐Ÿ”Ž Feature Engineering", "โš™๏ธ Model Selection", style="invis")
    c.edge("โš™๏ธ Model Selection", "๐ŸŽ“ Model Training", style="invis")

with graph.subgraph(name="cluster_2") as c:
    c.attr(rank="3")
    c.attr(label=SWIM_LANES["Deploy and Predict"])
    c.edge("๐Ÿšข Model Deployment", "๐Ÿ“ก Model Serving", style="invis")
    c.edge("๐Ÿ“ก Model Serving", "๐Ÿ”ฎ Predictions", style="invis")

with graph.subgraph(name="cluster_3") as c:
    c.attr(rank="4")
    c.attr(label="Reinforcement Learning Human Feedback")
    c.edge("๐Ÿ”ฎ Predictions", "๐Ÿ‘ Feedback Collection", style="invis")
    c.edge("๐Ÿ‘ Feedback Collection", "๐Ÿค” Feedback Processing", style="invis")
    c.edge("๐Ÿค” Feedback Processing", "โœ๏ธ Model Updating", style="invis")

def render_graph():
    st.graphviz_chart(graph.source)

def update_graph():
    for i in range(60):
        # Update the graph with new inputs randomly
        graph.node("๐Ÿ“Š Data Collection", label=f"๐Ÿ“Š Data Collection\nData {random.randint(0,100)}")
        graph.node("๐Ÿงน Data Cleaning", label=f"๐Ÿงน Data Cleaning\nCleaned Data {random.randint(0,100)}")
        graph.node("๐Ÿ”ง Data Transformation", label=f"๐Ÿ”ง Data Transformation\nTransformed Data {random.randint(0,100)}")
        graph.node("๐Ÿ”Ž Feature Engineering", label=f"๐Ÿ”Ž Feature Engineering\nFeatures {random.randint(0,100)}")
        graph.node("โš™๏ธ Model Selection", label=f"โš™๏ธ Model Selection\nSelected Model {random.randint(0,100)}")
        graph.node("๐ŸŽ“ Model Training", label=f"๐ŸŽ“ Model Training\nTrained Model {random.randint(0,100)}")
        graph.node("๐Ÿšข Model Deployment", label=f"๐Ÿšข Model Deployment\nDeployed Model {random.randint(0,100)}")
        graph.node("๐Ÿ“ก Model Serving", label=f"๐Ÿ“ก Model Serving\nServed Model {random.randint(0,100)}")
        graph.node("๐Ÿ”ฎ Predictions", label=f"๐Ÿ”ฎ Predictions\nPredicted Results {random.randint(0,100)}")
        graph.node("๐Ÿ‘ Feedback Collection", label=f"๐Ÿ‘ Feedback Collection\nFeedback {random.randint(0,100)}")
        graph.node("๐Ÿค” Feedback Processing", label=f"๐Ÿค” Feedback Processing\nProcessed Feedback {random.randint(0,100)}")
        graph.node("โœ๏ธ Model Updating", label=f"โœ๏ธ Model Updating\nUpdated Model {random.randint(0,100)}")
        
        # Render the updated graph
        render_graph()
        
        # Wait for 1 second
        time.sleep(1)
        
# Render the initial graph
render_graph()

# Update the graph every second for 60 seconds
update_graph()