File size: 6,547 Bytes
eb7c3ee
 
33ffe7d
eb7c3ee
33ffe7d
eb7c3ee
 
 
 
33ffe7d
eb7c3ee
 
 
 
 
 
 
 
 
 
 
33ffe7d
eb7c3ee
 
 
 
 
33ffe7d
eb7c3ee
 
 
 
 
 
 
33ffe7d
eb7c3ee
33ffe7d
 
 
 
 
 
 
 
 
eb7c3ee
33ffe7d
eb7c3ee
 
 
 
 
 
 
33ffe7d
eb7c3ee
 
 
 
 
 
 
 
 
 
33ffe7d
eb7c3ee
 
 
 
33ffe7d
eb7c3ee
33ffe7d
eb7c3ee
 
33ffe7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb7c3ee
33ffe7d
 
 
 
 
 
 
 
 
eb7c3ee
 
33ffe7d
 
 
 
eb7c3ee
33ffe7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb7c3ee
 
33ffe7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb7c3ee
33ffe7d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb7c3ee
33ffe7d
eb7c3ee
 
 
 
 
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
import streamlit as st

# ---------- Page Config ----------
st.set_page_config(
    page_title="πŸ“˜ Machine Learning Notes Hub",
    layout="wide",
    initial_sidebar_state="expanded"
)

# ---------- Custom CSS ----------
st.markdown("""
    <style>
    .main-title {
        font-size: 3rem;
        color: #004080;
        font-weight: 700;
        text-align: center;
        margin-bottom: 0.5rem;
    }
    .subtitle {
        font-size: 1.2rem;
        color: #555;
        text-align: center;
        margin-bottom: 2rem;
    }
    .note-box {
        background-color: #f9f9f9;
        padding: 1rem;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        margin-bottom: 1rem;
    }
    </style>
""", unsafe_allow_html=True)

# ---------- Sidebar Navigation ----------
st.sidebar.title("πŸ“š ML Notebook")
page = st.sidebar.radio("Go to", [
    "Home",
    "Supervised Learning",
    "Unsupervised Learning",
    "Evaluation Metrics",
    "Data Preprocessing",
    "Interview Tips",
    "Resources"
])

# ---------- Home Page ----------
if page == "Home":
    st.markdown('<div class="main-title">πŸ“˜ Machine Learning Notes</div>', unsafe_allow_html=True)
    st.markdown('<div class="subtitle">Your personal guide to mastering ML concepts!</div>', unsafe_allow_html=True)

    st.markdown("### πŸš€ Why Use This App?")
    st.markdown("""
    - Concise, organized ML notes
    - Beginner-friendly explanations with examples
    - Great for revision, projects, and interviews
    """)

    st.markdown('<div class="note-box">', unsafe_allow_html=True)
    st.markdown("### πŸ“Œ Topics Covered:")
    st.markdown("""
    - πŸ”Ή Supervised Learning  
    - πŸ”Ή Unsupervised Learning  
    - πŸ”Ή Model Evaluation Metrics  
    - πŸ”Ή Data Preprocessing  
    - πŸ”Ή Interview Tips  
    - πŸ”Ή Useful Resources  
    """)
    st.markdown('</div>', unsafe_allow_html=True)

    st.info("πŸ›  More features coming soon: interactive examples, quizzes, and visual diagrams!")

# ---------- Supervised Learning ----------
elif page == "Supervised Learning":
    st.title("πŸ” Supervised Learning")
    st.write("""
    Supervised Learning is a type of machine learning where the model learns from labeled data 
    β€” meaning the input comes with the correct output.
    """)

    with st.expander("πŸ“˜ Key Concepts"):
        st.markdown("""
        - **Goal:** Predict an output based on given input.
        - **Types:**
            - **Regression:** Predicts continuous values (e.g., house price prediction)
            - **Classification:** Predicts categories (e.g., spam or not spam)
        - **Examples:**
            - Predicting a student's exam score based on study hours (Regression)
            - Classifying emails as spam or not spam (Classification)
        """)

    with st.expander("πŸ’‘ Real-life Analogy"):
        st.write("""
        Imagine you are teaching a child to recognize fruits.
        You show an apple and say, "This is an apple."  
        You show a banana and say, "This is a banana."  
        After many examples, the child can identify fruits on their own.
        """)

# ---------- Unsupervised Learning ----------
elif page == "Unsupervised Learning":
    st.title("🧩 Unsupervised Learning")
    st.write("""
    Unsupervised Learning works with **unlabeled data** β€” meaning we only have inputs and no corresponding outputs.
    The algorithm tries to find patterns or groupings in the data.
    """)

    with st.expander("πŸ“˜ Key Concepts"):
        st.markdown("""
        - **Goal:** Discover hidden structure in data.
        - **Types:**
            - **Clustering:** Grouping similar items together (e.g., customer segmentation)
            - **Dimensionality Reduction:** Reducing features while keeping important info (e.g., PCA)
        - **Examples:**
            - Grouping customers by purchasing behavior
            - Compressing images while keeping quality
        """)

    with st.expander("πŸ’‘ Real-life Analogy"):
        st.write("""
        Think of visiting a supermarket where items are grouped by similarity:  
        fruits in one section, vegetables in another.  
        Nobody told the store which items belong together β€” they just grouped them by observation.
        """)

# ---------- Evaluation Metrics ----------
elif page == "Evaluation Metrics":
    st.title("πŸ“ Model Evaluation Metrics")
    st.write("Evaluation metrics tell us how well our machine learning model is performing.")

    with st.expander("πŸ“Š For Classification"):
        st.markdown("""
        - **Accuracy** = Correct predictions / Total predictions
        - **Precision** = Of all predicted positives, how many are actually positive?
        - **Recall** = Of all actual positives, how many did we find?
        - **F1-Score** = Harmonic mean of precision & recall
        - **Confusion Matrix** = Table showing TP, FP, TN, FN
        """)

    with st.expander("πŸ“ˆ For Regression"):
        st.markdown("""
        - **MAE (Mean Absolute Error)** = Average absolute difference between predictions and actual values
        - **MSE (Mean Squared Error)** = Average of squared differences
        - **RMSE** = Square root of MSE
        - **RΒ² Score** = Proportion of variance explained by the model
        """)

# ---------- Data Preprocessing ----------
elif page == "Data Preprocessing":
    st.title("βš™ Data Preprocessing")
    st.write("""
    Preprocessing prepares raw data so that a machine learning model can use it effectively.
    """)

    with st.expander("πŸ“˜ Steps"):
        st.markdown("""
        1. **Handling Missing Values** β€” Remove or fill in missing data
        2. **Encoding Categorical Data** β€” Convert text labels to numbers
        3. **Feature Scaling** β€” Normalize or standardize values
        4. **Removing Outliers** β€” Detect and handle extreme values
        """)

# ---------- Interview Tips ----------
elif page == "Interview Tips":
    st.title("πŸ’Ό ML Interview Tips")
    st.markdown("""
    - Be clear with definitions and examples
    - Explain algorithms with analogies
    - Understand trade-offs between models
    - Practice with real datasets
    """)

# ---------- Resources ----------
elif page == "Resources":
    st.title("πŸ“š Useful Resources")
    st.markdown("""
    - [Scikit-learn Docs](https://scikit-learn.org/)
    - [Kaggle Courses](https://www.kaggle.com/learn)
    - [Google ML Crash Course](https://developers.google.com/machine-learning/crash-course)
    """)