Spaces:
Build error
Build error
Commit
Β·
2ae5419
1
Parent(s):
d0fac9e
pages old commit
Browse files- pages/01_introduction.py +153 -0
- pages/02_ml_vs_dl.py +171 -0
- pages/03_life_cycle_of_ml_project.py +62 -0
- pages/04_data.py +181 -0
pages/01_introduction.py
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from streamlit_lottie import st_lottie
|
3 |
+
import requests
|
4 |
+
|
5 |
+
# Function to load Lottie animations
|
6 |
+
def load_lottie_url(url: str):
|
7 |
+
r = requests.get(url)
|
8 |
+
if r.status_code == 200:
|
9 |
+
return r.json()
|
10 |
+
else:
|
11 |
+
return None
|
12 |
+
|
13 |
+
# Function to display the content of each page
|
14 |
+
def show_content(topic):
|
15 |
+
if topic == "Introduction":
|
16 |
+
st.title("Understanding Data Science and Artificial Intelligence π")
|
17 |
+
st.subheader("Overview of AI and Data Science")
|
18 |
+
st.write("""
|
19 |
+
Artificial Intelligence (AI) and Data Science have become buzzwords in today's tech-driven world.
|
20 |
+
But what do they really mean, and why are they so significant? Letβs explore these fascinating concepts step by step!
|
21 |
+
""")
|
22 |
+
|
23 |
+
# Load the Lottie animation
|
24 |
+
lottie_url = "https://assets4.lottiefiles.com/packages/lf20_tcbkqj.json"
|
25 |
+
animation_data = load_lottie_url(lottie_url)
|
26 |
+
if animation_data:
|
27 |
+
st_lottie(animation_data, speed=1, width=600, height=400)
|
28 |
+
else:
|
29 |
+
st.write("Unable to load animation.")
|
30 |
+
|
31 |
+
elif topic == "Understanding Intelligence":
|
32 |
+
st.title("Understanding Intelligence")
|
33 |
+
st.subheader("What is Natural Intelligence? πΎ")
|
34 |
+
st.write("""
|
35 |
+
**Definition**: NI refers to the intelligence naturally present in living beings.
|
36 |
+
**Examples**:
|
37 |
+
- A dog learning a trick. π
|
38 |
+
- Humans solving puzzles or making everyday decisions. π§
|
39 |
+
""")
|
40 |
+
st.subheader("What is Artificial Intelligence? π€")
|
41 |
+
st.write("""
|
42 |
+
**Definition**: Artificial intelligence (AI) is man-made intelligence where machines mimic human intelligence to perform tasks.
|
43 |
+
**Real-Life Examples**:
|
44 |
+
- Netflix recommending shows youβd love. π¬
|
45 |
+
- Google Maps finding the fastest route. πΊοΈ
|
46 |
+
- Alexa answering your questions. ποΈ
|
47 |
+
""")
|
48 |
+
|
49 |
+
elif topic == "AI Tools: ML, DL, and Gen-AI":
|
50 |
+
st.title("AI Tools: ML, DL, and Gen-AI")
|
51 |
+
st.subheader("Machine Learning (ML) π₯οΈ")
|
52 |
+
st.write("""
|
53 |
+
- **What It Does**: ML enables machines to learn from patterns in data and make decisions.
|
54 |
+
- **How It Works**: Similar to teaching a toddler to recognize fruits, ML algorithms process large datasets to "learn" and predict outcomes.
|
55 |
+
- **Real-Life Applications**: Spam email detection π§, Predicting stock prices π.
|
56 |
+
""")
|
57 |
+
st.subheader("Deep Learning (DL) π€Ώ")
|
58 |
+
st.write("""
|
59 |
+
- **What It Does**: DL uses neural networks to process and analyze complex data.
|
60 |
+
- **How It Works**: DL processes data in layers, enabling machines to perform sophisticated tasks like facial recognition and medical imaging.
|
61 |
+
- **Real-Life Applications**: Self-driving cars π, Virtual assistants like Siri and Alexa. ποΈ
|
62 |
+
""")
|
63 |
+
st.subheader("Generative AI (Gen-AI) π¨")
|
64 |
+
st.write("""
|
65 |
+
- **What It Does**: Gen-AI enables machines to generate new content like text, images, and music.
|
66 |
+
- **How It Works**: By learning patterns from data, Gen-AI creates outputs that feel original and human-like.
|
67 |
+
- **Real-Life Applications**: ChatGPT (text generation), DALLΒ·E (image creation).
|
68 |
+
""")
|
69 |
+
|
70 |
+
elif topic == "Real-Life Analogies and Examples":
|
71 |
+
st.title("Real-Life Analogies and Examples")
|
72 |
+
st.subheader("Analogy: Tools Are Like Pens and Pencils")
|
73 |
+
st.write("""
|
74 |
+
- ML: Learns patterns (like sketching with a pencil).
|
75 |
+
- DL: Adds depth and detail (like using a pen).
|
76 |
+
- Gen-AI: Creates entirely new outputs (like turning sketches into colorful artwork).
|
77 |
+
""")
|
78 |
+
st.subheader("Learning vs. Generating: The Art Example π©βπ¨")
|
79 |
+
st.write("""
|
80 |
+
Think of a child learning to draw:
|
81 |
+
- First, they learn the basics of drawing.
|
82 |
+
- Then they generate their own unique artwork.
|
83 |
+
|
84 |
+
AI follows the same process:
|
85 |
+
- Learning: ML and DL handle this part.
|
86 |
+
- Generating: Gen-AI takes over to create new outputs.
|
87 |
+
""")
|
88 |
+
|
89 |
+
elif topic == "What is Data Science?":
|
90 |
+
st.title("What is Data Science? π")
|
91 |
+
st.write("""
|
92 |
+
Data Science is the art of extracting meaningful insights from raw data. It combines AI with statistics, computer science, and domain expertise to solve real-world problems.
|
93 |
+
**Key Components of Data Science**:
|
94 |
+
- **Data Collection**: Gathering information from various sources.
|
95 |
+
- **Data Analysis**: Using tools to find patterns and trends.
|
96 |
+
- **Data Visualization**: Presenting findings through charts and graphs.
|
97 |
+
""")
|
98 |
+
|
99 |
+
elif topic == "The Role of a Data Scientist":
|
100 |
+
st.title("The Role of a Data Scientist")
|
101 |
+
st.write("""
|
102 |
+
A Data Scientist plays a crucial role in:
|
103 |
+
- Building predictive models.
|
104 |
+
- Analyzing customer behavior.
|
105 |
+
- Designing solutions for business challenges.
|
106 |
+
|
107 |
+
**Tools Used**: Python, R, SQL, Tableau, etc.
|
108 |
+
""")
|
109 |
+
|
110 |
+
elif topic == "Why AI and Data Science Matter":
|
111 |
+
st.title("Why AI and Data Science Matter")
|
112 |
+
st.write("""
|
113 |
+
AI and Data Science are transforming industries by:
|
114 |
+
- Automating tasks.
|
115 |
+
- Enhancing decision-making.
|
116 |
+
- Unlocking creative possibilities.
|
117 |
+
|
118 |
+
**Fun Fact**: By 2030, AI is expected to add $15.7 trillion to the global economy. π
|
119 |
+
""")
|
120 |
+
|
121 |
+
elif topic == "Did You Know?":
|
122 |
+
st.title("Did You Know?")
|
123 |
+
st.write("""
|
124 |
+
**AI is already being used to**:
|
125 |
+
- Detect diseases in medical imaging.
|
126 |
+
- Automate farming for higher crop yields.
|
127 |
+
- Generate movie scripts and music albums.
|
128 |
+
""")
|
129 |
+
|
130 |
+
# Set up sidebar navigation
|
131 |
+
topics = [
|
132 |
+
"Introduction",
|
133 |
+
"Understanding Intelligence",
|
134 |
+
"AI Tools: ML, DL, and Gen-AI",
|
135 |
+
"Real-Life Analogies and Examples",
|
136 |
+
"What is Data Science?",
|
137 |
+
"The Role of a Data Scientist",
|
138 |
+
"Why AI and Data Science Matter",
|
139 |
+
"Did You Know?"
|
140 |
+
]
|
141 |
+
|
142 |
+
st.sidebar.title("Topics")
|
143 |
+
selection = st.sidebar.radio("Go to", topics)
|
144 |
+
|
145 |
+
# Initialize session state with the first topic as the default
|
146 |
+
if "page" not in st.session_state:
|
147 |
+
st.session_state.page = topics[0]
|
148 |
+
|
149 |
+
# Update session state automatically when sidebar selection changes
|
150 |
+
st.session_state.page = selection
|
151 |
+
|
152 |
+
# Display the selected content
|
153 |
+
show_content(st.session_state.page)
|
pages/02_ml_vs_dl.py
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import streamlit as st
|
2 |
+
# from streamlit_lottie import st_lottie
|
3 |
+
# import requests
|
4 |
+
|
5 |
+
# # Function to load Lottie animations
|
6 |
+
# def load_lottie_url(url: str):
|
7 |
+
# response = requests.get(url)
|
8 |
+
# if response.status_code != 200:
|
9 |
+
# return None
|
10 |
+
# return response.json()
|
11 |
+
|
12 |
+
# # Load Lottie animations (you can uncomment these as per your need)
|
13 |
+
# # lottie_ml = load_lottie_url("https://assets8.lottiefiles.com/packages/lf20_5eyehzdr.json")
|
14 |
+
# # lottie_dl = load_lottie_url("https://assets8.lottiefiles.com/packages/lf20_vfnu1k6m.json")
|
15 |
+
|
16 |
+
# # Sidebar navigation
|
17 |
+
# st.sidebar.title("Navigation")
|
18 |
+
# page = st.sidebar.radio("Go to:", ["Home", "ML vs DL", "Comparison Table"])
|
19 |
+
|
20 |
+
# # Add Navigate button to update page
|
21 |
+
# if st.sidebar.button("Navigate"):
|
22 |
+
# st.session_state.page = page
|
23 |
+
|
24 |
+
# # Set page to session state if not already defined
|
25 |
+
# if "page" not in st.session_state:
|
26 |
+
# st.session_state.page = page
|
27 |
+
|
28 |
+
# # Home page
|
29 |
+
# if st.session_state.page == "Home":
|
30 |
+
# st.title("Understanding Machine Learning and Deep Learning")
|
31 |
+
# st.markdown(
|
32 |
+
# """
|
33 |
+
# Welcome to the interactive guide on Machine Learning (ML) and Deep Learning (DL). This space helps you
|
34 |
+
# explore the differences, capabilities, and applications of ML and DL in a structured manner.
|
35 |
+
# """
|
36 |
+
# )
|
37 |
+
# # If lottie_ml is loaded, display it (uncomment the following line when using animations)
|
38 |
+
# # if lottie_ml:
|
39 |
+
# # st_lottie(lottie_ml, height=300, key="ml_home")
|
40 |
+
|
41 |
+
# # ML vs DL page
|
42 |
+
# elif st.session_state.page == "ML vs DL":
|
43 |
+
# st.title("Difference Between Machine Learning (ML) and Deep Learning (DL)")
|
44 |
+
|
45 |
+
# st.subheader("Machine Learning π₯οΈ")
|
46 |
+
# st.markdown(
|
47 |
+
# """
|
48 |
+
# - Uses statistics to understand patterns in data and make predictions π.
|
49 |
+
# - Can learn with less data π.
|
50 |
+
# - Handles structured data; unstructured data must be converted to structured form π.
|
51 |
+
# - Requires less memory π§ πΎ.
|
52 |
+
# - Trains models in less time β±οΈ.
|
53 |
+
# - Can run efficiently on CPUs without requiring powerful hardware π₯οΈ.
|
54 |
+
# """
|
55 |
+
# )
|
56 |
+
|
57 |
+
# st.subheader("Deep Learning π€")
|
58 |
+
# st.markdown(
|
59 |
+
# """
|
60 |
+
# - Uses neural networks to mimic brain-like learning and decision-making π§ .
|
61 |
+
# - Requires large amounts of data for better accuracy π½οΈπ.
|
62 |
+
# - Handles both structured and unstructured data like images, text, and audio πΌοΈππ§.
|
63 |
+
# - Requires more memory and storage π§ πΎ.
|
64 |
+
# - Takes more time to train due to complex calculations β±οΈ.
|
65 |
+
# - Needs GPUs and advanced hardware for efficient processing π₯οΈπ‘.
|
66 |
+
# """
|
67 |
+
# )
|
68 |
+
# # If lottie_dl is loaded, display it (uncomment the following line when using animations)
|
69 |
+
# # if lottie_dl:
|
70 |
+
# # st_lottie(lottie_dl, height=300, key="dl_page")
|
71 |
+
|
72 |
+
# # Comparison Table page
|
73 |
+
# elif st.session_state.page == "Comparison Table":
|
74 |
+
# st.title("Comparison Table: ML vs DL")
|
75 |
+
|
76 |
+
# st.markdown(
|
77 |
+
# """
|
78 |
+
# | **Aspect** | **Machine Learning (ML)** | **Deep Learning (DL)** |
|
79 |
+
# |-------------------------|-------------------------------------------------|-------------------------------------------------|
|
80 |
+
# | **Definition** | Uses algorithms and statistics to learn from data. | Uses neural networks to mimic brain-like decision-making. |
|
81 |
+
# | **Data Dependency** | Works well with smaller datasets. | Requires large datasets for better accuracy. |
|
82 |
+
# | **Data Type** | Handles structured data only. | Handles both structured and unstructured data. |
|
83 |
+
# | **Training Time** | Requires less time to train. | Requires more time to train. |
|
84 |
+
# | **Hardware** | Can run on CPUs. | Requires GPUs and advanced hardware. |
|
85 |
+
# | **Memory Requirement** | Uses less memory. | Requires more memory and storage. |
|
86 |
+
# """
|
87 |
+
# )
|
88 |
+
|
89 |
+
# st.info(
|
90 |
+
# "Did you know? Deep Learning models are inspired by the human brain, making them exceptionally powerful for tasks like image recognition and natural language processing!"
|
91 |
+
# )
|
92 |
+
|
93 |
+
import streamlit as st
|
94 |
+
from streamlit_lottie import st_lottie
|
95 |
+
import requests
|
96 |
+
|
97 |
+
# Function to load Lottie animations
|
98 |
+
def load_lottie_url(url: str):
|
99 |
+
response = requests.get(url)
|
100 |
+
if response.status_code != 200:
|
101 |
+
return None
|
102 |
+
return response.json()
|
103 |
+
|
104 |
+
# Sidebar navigation
|
105 |
+
st.sidebar.title("Navigation")
|
106 |
+
page = st.sidebar.radio("Go to:", ["Home", "ML vs DL", "Comparison Table"])
|
107 |
+
|
108 |
+
# Initialize session state if not already done
|
109 |
+
if "page" not in st.session_state:
|
110 |
+
st.session_state.page = page
|
111 |
+
else:
|
112 |
+
st.session_state.page = page # Automatically update the session state when the radio selection changes
|
113 |
+
|
114 |
+
# Home page
|
115 |
+
if st.session_state.page == "Home":
|
116 |
+
st.title("Understanding Machine Learning and Deep Learning")
|
117 |
+
st.markdown(
|
118 |
+
"""
|
119 |
+
Welcome to the interactive guide on Machine Learning (ML) and Deep Learning (DL). This space helps you
|
120 |
+
explore the differences, capabilities, and applications of ML and DL in a structured manner.
|
121 |
+
"""
|
122 |
+
)
|
123 |
+
|
124 |
+
# ML vs DL page
|
125 |
+
elif st.session_state.page == "ML vs DL":
|
126 |
+
st.title("Difference Between Machine Learning (ML) and Deep Learning (DL)")
|
127 |
+
|
128 |
+
st.subheader("Machine Learning π₯οΈ")
|
129 |
+
st.markdown(
|
130 |
+
"""
|
131 |
+
- Uses statistics to understand patterns in data and make predictions π.
|
132 |
+
- Can learn with less data π.
|
133 |
+
- Handles structured data; unstructured data must be converted to structured form π.
|
134 |
+
- Requires less memory π§ πΎ.
|
135 |
+
- Trains models in less time β±οΈ.
|
136 |
+
- Can run efficiently on CPUs without requiring powerful hardware π₯οΈ.
|
137 |
+
"""
|
138 |
+
)
|
139 |
+
|
140 |
+
st.subheader("Deep Learning π€")
|
141 |
+
st.markdown(
|
142 |
+
"""
|
143 |
+
- Uses neural networks to mimic brain-like learning and decision-making π§ .
|
144 |
+
- Requires large amounts of data for better accuracy π½οΈπ.
|
145 |
+
- Handles both structured and unstructured data like images, text, and audio πΌοΈππ§.
|
146 |
+
- Requires more memory and storage π§ πΎ.
|
147 |
+
- Takes more time to train due to complex calculations β±οΈ.
|
148 |
+
- Needs GPUs and advanced hardware for efficient processing π₯οΈπ‘.
|
149 |
+
"""
|
150 |
+
)
|
151 |
+
|
152 |
+
# Comparison Table page
|
153 |
+
elif st.session_state.page == "Comparison Table":
|
154 |
+
st.title("Comparison Table: ML vs DL")
|
155 |
+
|
156 |
+
st.markdown(
|
157 |
+
"""
|
158 |
+
| **Aspect** | **Machine Learning (ML)** | **Deep Learning (DL)** |
|
159 |
+
|-------------------------|-------------------------------------------------|-------------------------------------------------|
|
160 |
+
| **Definition** | Uses algorithms and statistics to learn from data. | Uses neural networks to mimic brain-like decision-making. |
|
161 |
+
| **Data Dependency** | Works well with smaller datasets. | Requires large datasets for better accuracy. |
|
162 |
+
| **Data Type** | Handles structured data only. | Handles both structured and unstructured data. |
|
163 |
+
| **Training Time** | Requires less time to train. | Requires more time to train. |
|
164 |
+
| **Hardware** | Can run on CPUs. | Requires GPUs and advanced hardware. |
|
165 |
+
| **Memory Requirement** | Uses less memory. | Requires more memory and storage. |
|
166 |
+
"""
|
167 |
+
)
|
168 |
+
|
169 |
+
st.info(
|
170 |
+
"Did you know? Deep Learning models are inspired by the human brain, making them exceptionally powerful for tasks like image recognition and natural language processing!"
|
171 |
+
)
|
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()
|
pages/04_data.py
ADDED
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
def main():
|
4 |
+
st.set_page_config(page_title="Data Demystified", page_icon="π", layout="wide")
|
5 |
+
|
6 |
+
# Custom CSS for better engagement
|
7 |
+
st.markdown("""
|
8 |
+
<style>
|
9 |
+
.highlight-box {
|
10 |
+
padding: 1rem;
|
11 |
+
border-radius: 10px;
|
12 |
+
background: #f0f2f6;
|
13 |
+
margin: 1rem 0;
|
14 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
15 |
+
}
|
16 |
+
.fun-fact {
|
17 |
+
color: #2e7d32;
|
18 |
+
font-weight: 500;
|
19 |
+
}
|
20 |
+
.emoji-header {
|
21 |
+
font-size: 2.5rem !important;
|
22 |
+
margin-bottom: 1rem;
|
23 |
+
}
|
24 |
+
</style>
|
25 |
+
""", unsafe_allow_html=True)
|
26 |
+
|
27 |
+
pages = {
|
28 |
+
"π Introduction": intro_page,
|
29 |
+
"π Data Types Overview": types_page,
|
30 |
+
"ποΈ Structured Data": structured_page,
|
31 |
+
"π§© Semi-Structured Data": semi_structured_page,
|
32 |
+
"π¨ Unstructured Data": unstructured_page
|
33 |
+
}
|
34 |
+
|
35 |
+
with st.sidebar:
|
36 |
+
st.title("Navigation")
|
37 |
+
page = st.radio("Go to", list(pages.keys()))
|
38 |
+
|
39 |
+
pages[page]()
|
40 |
+
|
41 |
+
def intro_page():
|
42 |
+
st.markdown('<div class="emoji-header">π Welcome to Data Science Fundamentals</div>', unsafe_allow_html=True)
|
43 |
+
|
44 |
+
col1, col2 = st.columns([3, 2])
|
45 |
+
with col1:
|
46 |
+
st.write("""
|
47 |
+
### What is Data Science?
|
48 |
+
Data Science is the art of extracting meaningful insights from raw data -
|
49 |
+
like being a digital detective uncovering hidden patterns in the numbers!
|
50 |
+
|
51 |
+
**Did you know?** π€
|
52 |
+
<span class="fun-fact">Every day, we create 2.5 quintillion bytes of data -
|
53 |
+
that's equivalent to 250,000 Libraries of Congress!</span>
|
54 |
+
""", unsafe_allow_html=True)
|
55 |
+
|
56 |
+
st.markdown("""
|
57 |
+
### Why It Matters:
|
58 |
+
- Predict future trends π
|
59 |
+
- Solve complex problems π§©
|
60 |
+
- Power AI innovations π€
|
61 |
+
- Drive business decisions πΌ
|
62 |
+
""")
|
63 |
+
|
64 |
+
with col2:
|
65 |
+
st.image("https://cdn-uploads.huggingface.co/production/uploads/64c972774515835c4dadd754/qpmLGi47ucDCWYEi8eZhE.png",
|
66 |
+
caption="Data is Everywhere!", width=300)
|
67 |
+
|
68 |
+
def types_page():
|
69 |
+
st.header("π¦ The Three Data Superheroes")
|
70 |
+
|
71 |
+
with st.expander("π Quick Comparison"):
|
72 |
+
st.table({
|
73 |
+
"Type": ["Structured", "Semi-Structured", "Unstructured"],
|
74 |
+
"Organization": ["Perfectly Organized", "Partially Organized", "Chaotic Creativity"],
|
75 |
+
"Examples": ["SQL Databases, Excel", "JSON, XML, CSV", "Images, Videos, Text"]
|
76 |
+
})
|
77 |
+
|
78 |
+
cols = st.columns(3)
|
79 |
+
data_types = [
|
80 |
+
("ποΈ Structured", "Neat rows & columns", "#e3f2fd"),
|
81 |
+
("π§© Semi-Structured", "Flexible tags & markers", "#f0f4c3"),
|
82 |
+
("π¨ Unstructured", "Creative free-form", "#ffcdd2")
|
83 |
+
]
|
84 |
+
|
85 |
+
for col, (icon, desc, color) in zip(cols, data_types):
|
86 |
+
with col:
|
87 |
+
st.markdown(f"""
|
88 |
+
<div style="background: {color}; padding: 1rem; border-radius: 10px;">
|
89 |
+
<h3>{icon} {desc.split()[0]}</h3>
|
90 |
+
<p>{' '.join(desc.split()[1:])}</p>
|
91 |
+
</div>
|
92 |
+
""", unsafe_allow_html=True)
|
93 |
+
|
94 |
+
def structured_page():
|
95 |
+
st.header("ποΈ Structured Data: The Organized Perfectionist")
|
96 |
+
|
97 |
+
with st.container():
|
98 |
+
st.markdown("""
|
99 |
+
### Characteristics:
|
100 |
+
- Strict schema π
|
101 |
+
- Tabular format π
|
102 |
+
- Easy to query π
|
103 |
+
|
104 |
+
**Did you know?** π€
|
105 |
+
<span class="fun-fact">The first computerized database appeared in 1963 -
|
106 |
+
it weighed more than a car! ππΎ</span>
|
107 |
+
""", unsafe_allow_html=True)
|
108 |
+
|
109 |
+
st.image("https://cdn-uploads.huggingface.co/production/uploads/64c972774515835c4dadd754/dSbyOXaQ6N_Kg2TLxgEyt.png",
|
110 |
+
width=400, caption="Structured Data Example")
|
111 |
+
|
112 |
+
with st.expander("π‘ Real-World Examples"):
|
113 |
+
st.markdown("""
|
114 |
+
- Financial records π°
|
115 |
+
- Inventory systems π¦
|
116 |
+
- Student databases π
|
117 |
+
- Railway timetables π
|
118 |
+
""")
|
119 |
+
|
120 |
+
def semi_structured_page():
|
121 |
+
st.header("π§© Semi-Structured Data: The Flexible Friend")
|
122 |
+
|
123 |
+
with st.container():
|
124 |
+
st.markdown("""
|
125 |
+
### Why It's Special:
|
126 |
+
- Partial organization π
|
127 |
+
- Self-describing formats π
|
128 |
+
- Web-friendly π
|
129 |
+
|
130 |
+
**Did you know?** π€
|
131 |
+
<span class="fun-fact">JSON was created in 2001 -
|
132 |
+
the same year Wikipedia launched! ππ</span>
|
133 |
+
""", unsafe_allow_html=True)
|
134 |
+
|
135 |
+
cols = st.columns(2)
|
136 |
+
with cols[0]:
|
137 |
+
st.code("""
|
138 |
+
{
|
139 |
+
"name": "Data Hero",
|
140 |
+
"skills": ["JSON", "XML", "CSV"],
|
141 |
+
"mission": "Bring order to chaos!"
|
142 |
+
}
|
143 |
+
""", language="json")
|
144 |
+
|
145 |
+
with cols[1]:
|
146 |
+
st.markdown("""
|
147 |
+
### Common Formats:
|
148 |
+
- JSON (Web APIs) π
|
149 |
+
- XML (Document markup) π
|
150 |
+
- CSV (Spreadsheet data) π
|
151 |
+
- Email headers π§
|
152 |
+
""")
|
153 |
+
|
154 |
+
def unstructured_page():
|
155 |
+
st.header("π¨ Unstructured Data: The Creative Chaos")
|
156 |
+
|
157 |
+
with st.container():
|
158 |
+
st.markdown("""
|
159 |
+
### The Wild West of Data:
|
160 |
+
- No predefined format π¨
|
161 |
+
- Human-friendly formats π
|
162 |
+
- Requires AI processing π€
|
163 |
+
|
164 |
+
**Did you know?** π€
|
165 |
+
<span class="fun-fact">90% of all digital data is unstructured -
|
166 |
+
that's like having 1000 Netflix movies for every person on Earth! πΏπ</span>
|
167 |
+
""", unsafe_allow_html=True)
|
168 |
+
|
169 |
+
st.image("https://cdn-uploads.huggingface.co/production/uploads/64c972774515835c4dadd754/xhaNBRanDaj8esumqo9hl.png",
|
170 |
+
width=400, caption="Unstructured Data in Action")
|
171 |
+
|
172 |
+
with st.expander("π Modern Applications"):
|
173 |
+
st.markdown("""
|
174 |
+
- Facial recognition systems π©π»
|
175 |
+
- Voice assistants π£οΈ
|
176 |
+
- Medical image analysis π₯
|
177 |
+
- Social media monitoring π±
|
178 |
+
""")
|
179 |
+
|
180 |
+
if __name__ == "__main__":
|
181 |
+
main()
|