Archana731 commited on
Commit
33ffe7d
Β·
verified Β·
1 Parent(s): eb7c3ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +112 -18
app.py CHANGED
@@ -1,13 +1,13 @@
1
  import streamlit as st
2
 
3
- # Page settings
4
  st.set_page_config(
5
- page_title="πŸ“˜ ML Notes Hub",
6
  layout="wide",
7
  initial_sidebar_state="expanded"
8
  )
9
 
10
- # --- Custom CSS ---
11
  st.markdown("""
12
  <style>
13
  .main-title {
@@ -19,13 +19,13 @@ st.markdown("""
19
  }
20
  .subtitle {
21
  font-size: 1.2rem;
22
- color: #333333;
23
  text-align: center;
24
  margin-bottom: 2rem;
25
  }
26
  .note-box {
27
  background-color: #f9f9f9;
28
- padding: 1.5rem;
29
  border-radius: 10px;
30
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
31
  margin-bottom: 1rem;
@@ -33,11 +33,19 @@ st.markdown("""
33
  </style>
34
  """, unsafe_allow_html=True)
35
 
36
- # --- Sidebar Navigation ---
37
  st.sidebar.title("πŸ“š ML Notebook")
38
- page = st.sidebar.radio("Go to", ["Home", "Supervised Learning", "Unsupervised Learning", "Evaluation Metrics", "Resources"])
 
 
 
 
 
 
 
 
39
 
40
- # --- Home Page ---
41
  if page == "Home":
42
  st.markdown('<div class="main-title">πŸ“˜ Machine Learning Notes</div>', unsafe_allow_html=True)
43
  st.markdown('<div class="subtitle">Your personal guide to mastering ML concepts!</div>', unsafe_allow_html=True)
@@ -45,8 +53,7 @@ if page == "Home":
45
  st.markdown("### πŸš€ Why Use This App?")
46
  st.markdown("""
47
  - Concise, organized ML notes
48
- - Easy to navigate concepts
49
- - Interactive widgets (coming soon)
50
  - Great for revision, projects, and interviews
51
  """)
52
 
@@ -57,31 +64,118 @@ if page == "Home":
57
  - πŸ”Ή Unsupervised Learning
58
  - πŸ”Ή Model Evaluation Metrics
59
  - πŸ”Ή Data Preprocessing
60
- - πŸ”Ή Tips for Interviews
61
  - πŸ”Ή Useful Resources
62
  """)
63
  st.markdown('</div>', unsafe_allow_html=True)
64
 
65
- st.markdown("πŸ›  *More features coming soon: interactive examples, quizzes, and more!*")
66
 
67
- # --- Additional Pages Placeholder ---
68
  elif page == "Supervised Learning":
69
  st.title("πŸ” Supervised Learning")
70
- st.write("This section will contain detailed notes on regression, classification, and more.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
 
 
 
 
 
 
 
 
 
72
  elif page == "Unsupervised Learning":
73
  st.title("🧩 Unsupervised Learning")
74
- st.write("Learn about clustering, dimensionality reduction, and pattern discovery.")
 
 
 
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  elif page == "Evaluation Metrics":
77
  st.title("πŸ“ Model Evaluation Metrics")
78
- st.write("Accuracy, precision, recall, F1-score, confusion matrix and more.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  elif page == "Resources":
81
- st.title("πŸ“š Resources")
82
  st.markdown("""
83
  - [Scikit-learn Docs](https://scikit-learn.org/)
84
  - [Kaggle Courses](https://www.kaggle.com/learn)
85
  - [Google ML Crash Course](https://developers.google.com/machine-learning/crash-course)
86
  """)
87
-
 
1
  import streamlit as st
2
 
3
+ # ---------- Page Config ----------
4
  st.set_page_config(
5
+ page_title="πŸ“˜ Machine Learning Notes Hub",
6
  layout="wide",
7
  initial_sidebar_state="expanded"
8
  )
9
 
10
+ # ---------- Custom CSS ----------
11
  st.markdown("""
12
  <style>
13
  .main-title {
 
19
  }
20
  .subtitle {
21
  font-size: 1.2rem;
22
+ color: #555;
23
  text-align: center;
24
  margin-bottom: 2rem;
25
  }
26
  .note-box {
27
  background-color: #f9f9f9;
28
+ padding: 1rem;
29
  border-radius: 10px;
30
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
31
  margin-bottom: 1rem;
 
33
  </style>
34
  """, unsafe_allow_html=True)
35
 
36
+ # ---------- Sidebar Navigation ----------
37
  st.sidebar.title("πŸ“š ML Notebook")
38
+ page = st.sidebar.radio("Go to", [
39
+ "Home",
40
+ "Supervised Learning",
41
+ "Unsupervised Learning",
42
+ "Evaluation Metrics",
43
+ "Data Preprocessing",
44
+ "Interview Tips",
45
+ "Resources"
46
+ ])
47
 
48
+ # ---------- Home Page ----------
49
  if page == "Home":
50
  st.markdown('<div class="main-title">πŸ“˜ Machine Learning Notes</div>', unsafe_allow_html=True)
51
  st.markdown('<div class="subtitle">Your personal guide to mastering ML concepts!</div>', unsafe_allow_html=True)
 
53
  st.markdown("### πŸš€ Why Use This App?")
54
  st.markdown("""
55
  - Concise, organized ML notes
56
+ - Beginner-friendly explanations with examples
 
57
  - Great for revision, projects, and interviews
58
  """)
59
 
 
64
  - πŸ”Ή Unsupervised Learning
65
  - πŸ”Ή Model Evaluation Metrics
66
  - πŸ”Ή Data Preprocessing
67
+ - πŸ”Ή Interview Tips
68
  - πŸ”Ή Useful Resources
69
  """)
70
  st.markdown('</div>', unsafe_allow_html=True)
71
 
72
+ st.info("πŸ›  More features coming soon: interactive examples, quizzes, and visual diagrams!")
73
 
74
+ # ---------- Supervised Learning ----------
75
  elif page == "Supervised Learning":
76
  st.title("πŸ” Supervised Learning")
77
+ st.write("""
78
+ Supervised Learning is a type of machine learning where the model learns from labeled data
79
+ β€” meaning the input comes with the correct output.
80
+ """)
81
+
82
+ with st.expander("πŸ“˜ Key Concepts"):
83
+ st.markdown("""
84
+ - **Goal:** Predict an output based on given input.
85
+ - **Types:**
86
+ - **Regression:** Predicts continuous values (e.g., house price prediction)
87
+ - **Classification:** Predicts categories (e.g., spam or not spam)
88
+ - **Examples:**
89
+ - Predicting a student's exam score based on study hours (Regression)
90
+ - Classifying emails as spam or not spam (Classification)
91
+ """)
92
 
93
+ with st.expander("πŸ’‘ Real-life Analogy"):
94
+ st.write("""
95
+ Imagine you are teaching a child to recognize fruits.
96
+ You show an apple and say, "This is an apple."
97
+ You show a banana and say, "This is a banana."
98
+ After many examples, the child can identify fruits on their own.
99
+ """)
100
+
101
+ # ---------- Unsupervised Learning ----------
102
  elif page == "Unsupervised Learning":
103
  st.title("🧩 Unsupervised Learning")
104
+ st.write("""
105
+ Unsupervised Learning works with **unlabeled data** β€” meaning we only have inputs and no corresponding outputs.
106
+ The algorithm tries to find patterns or groupings in the data.
107
+ """)
108
 
109
+ with st.expander("πŸ“˜ Key Concepts"):
110
+ st.markdown("""
111
+ - **Goal:** Discover hidden structure in data.
112
+ - **Types:**
113
+ - **Clustering:** Grouping similar items together (e.g., customer segmentation)
114
+ - **Dimensionality Reduction:** Reducing features while keeping important info (e.g., PCA)
115
+ - **Examples:**
116
+ - Grouping customers by purchasing behavior
117
+ - Compressing images while keeping quality
118
+ """)
119
+
120
+ with st.expander("πŸ’‘ Real-life Analogy"):
121
+ st.write("""
122
+ Think of visiting a supermarket where items are grouped by similarity:
123
+ fruits in one section, vegetables in another.
124
+ Nobody told the store which items belong together β€” they just grouped them by observation.
125
+ """)
126
+
127
+ # ---------- Evaluation Metrics ----------
128
  elif page == "Evaluation Metrics":
129
  st.title("πŸ“ Model Evaluation Metrics")
130
+ st.write("Evaluation metrics tell us how well our machine learning model is performing.")
131
+
132
+ with st.expander("πŸ“Š For Classification"):
133
+ st.markdown("""
134
+ - **Accuracy** = Correct predictions / Total predictions
135
+ - **Precision** = Of all predicted positives, how many are actually positive?
136
+ - **Recall** = Of all actual positives, how many did we find?
137
+ - **F1-Score** = Harmonic mean of precision & recall
138
+ - **Confusion Matrix** = Table showing TP, FP, TN, FN
139
+ """)
140
+
141
+ with st.expander("πŸ“ˆ For Regression"):
142
+ st.markdown("""
143
+ - **MAE (Mean Absolute Error)** = Average absolute difference between predictions and actual values
144
+ - **MSE (Mean Squared Error)** = Average of squared differences
145
+ - **RMSE** = Square root of MSE
146
+ - **RΒ² Score** = Proportion of variance explained by the model
147
+ """)
148
 
149
+ # ---------- Data Preprocessing ----------
150
+ elif page == "Data Preprocessing":
151
+ st.title("βš™ Data Preprocessing")
152
+ st.write("""
153
+ Preprocessing prepares raw data so that a machine learning model can use it effectively.
154
+ """)
155
+
156
+ with st.expander("πŸ“˜ Steps"):
157
+ st.markdown("""
158
+ 1. **Handling Missing Values** β€” Remove or fill in missing data
159
+ 2. **Encoding Categorical Data** β€” Convert text labels to numbers
160
+ 3. **Feature Scaling** β€” Normalize or standardize values
161
+ 4. **Removing Outliers** β€” Detect and handle extreme values
162
+ """)
163
+
164
+ # ---------- Interview Tips ----------
165
+ elif page == "Interview Tips":
166
+ st.title("πŸ’Ό ML Interview Tips")
167
+ st.markdown("""
168
+ - Be clear with definitions and examples
169
+ - Explain algorithms with analogies
170
+ - Understand trade-offs between models
171
+ - Practice with real datasets
172
+ """)
173
+
174
+ # ---------- Resources ----------
175
  elif page == "Resources":
176
+ st.title("πŸ“š Useful Resources")
177
  st.markdown("""
178
  - [Scikit-learn Docs](https://scikit-learn.org/)
179
  - [Kaggle Courses](https://www.kaggle.com/learn)
180
  - [Google ML Crash Course](https://developers.google.com/machine-learning/crash-course)
181
  """)