File size: 6,524 Bytes
ef1b78e
 
 
 
 
78d0f9b
ef1b78e
6d12503
ef1b78e
a52d623
 
 
 
 
 
 
 
5719512
 
a52d623
 
5719512
 
 
323c454
 
5719512
323c454
 
5719512
323c454
d17ad02
5719512
 
a52d623
323c454
27e3662
a52d623
 
 
 
5719512
a52d623
d17ad02
5719512
a52d623
5719512
323c454
27e3662
 
a52d623
323c454
d17ad02
323c454
 
d17ad02
27e3662
 
d17ad02
5719512
a52d623
5719512
323c454
 
d17ad02
a52d623
 
 
 
5719512
323c454
d17ad02
323c454
 
d17ad02
323c454
50c6518
 
a52d623
323c454
50c6518
323c454
 
 
50c6518
323c454
 
 
50c6518
323c454
27e3662
8905fdc
 
 
067e7c8
8905fdc
 
067e7c8
 
 
8905fdc
067e7c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8905fdc
067e7c8
 
 
 
 
 
 
 
 
 
 
8905fdc
067e7c8
 
 
 
 
8905fdc
067e7c8
8905fdc
067e7c8
 
 
 
 
 
 
5ad7135
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
import streamlit as st
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd


st.set_page_config(
    page_title="Model Building",
    page_icon="🚀",
    layout="wide")

if "current_page" not in st.session_state:
    st.session_state.current_page = "main"

def navigate_to(page_name):
    st.session_state.current_page = page_name


st.markdown("""
    <h1 style="text-align: center; color: #BB3385;">Model Building</h1>
    <p style="text-align: center; font-size: 18px;">Welcome to one of the most exciting parts of machine learning – teaching the machine how to learn!</p>
""", unsafe_allow_html=True)

st.markdown("""
<h3 style='color:#2a52be;'>What is Model Training?</h3>
<p><strong>Model training</strong> is the process of teaching a machine learning model to understand patterns from data.The model learns with the help of:</p>

<p>→ <strong>Data</strong> – examples that already have correct answers</p>
<p>→ <strong>Algorithm</strong> – a method that helps the model learn from the data</p>

<p>Once the training is complete, the model can start making predictions or decisions on new, unseen data.</p>
""", unsafe_allow_html=True)

st.markdown("""
<h4 style='color:#BB3385;'>For Example</h4>
Think of yourself as a teacher, and the machine as a student.You show math problems (inputs) and answers (outputs). The student starts to learn patterns.

Just like that:
- Machine = student
- Data = problem
- Algorithm = learning method

After training, the model is ready to solve new problems.
""", unsafe_allow_html=True)


st.markdown("""
<h3 style='color:#2a52be;'>Who Are We Actually Training?</h3>
<p>We are training machines to learn — not robots or humans, but something called a <strong>machine learning model</strong>.</p>
<p>This model is like a smart system that doesn’t know anything in the beginning. It needs examples and a method to understand those examples.</p>

<p>As programmers, the machine is guided to learn by providing:</p>

<p>▶ <strong>Data</strong> – the examples it should learn from</p>
<p>▶ <strong>Algorithm</strong> – the method it should use to learn from the data</p>

<p>With the right guidance, the machine can learn how to make decisions on its own.The machine follows the steps given by the algorithm to learn from the data.</p>
<p>If the learning doesn’t go well, we usually don’t change the data. Instead, we try using a better algorithm that suits the data.So, how we guide the machine using the algorithm is very important for its learning.</p>
""", unsafe_allow_html=True)


st.markdown("""
<h3 style='color:#2a52be;'>Picking the Right Learning Style</h3>
<p>Now that the data is ready, we need to choose how the machine should learn from it.There are different learning styles, just like there are different ways people learn.</p>

- **Supervised** – learning from labeled data
- **Unsupervised** – learning without answers 
- **Semi-supervised** – mix of both
- **Reinforcement** – learn by doing

<p>In supervised learning, there are two main types of tasks — classification and regression.</p>

<p>• <strong>Classification</strong> is used when the goal is to predict a category or group.For example: "Yes" or "No", or types like "Apple", "Banana", or "Orange".</p>
<p>• <strong>Regression</strong> is used when the goal is to predict a number or value.For example: price, temperature, or a score.</p>

<p>The choice depends on the type of output expected — category or number.Both are powerful and used in different kinds of problems.</p>
""", unsafe_allow_html=True)

st.markdown("""
<h3 style='color:#2a52be;'>Preparing and Splitting the Data</h3>

<p>Before training a machine learning model, the data must be prepared properly. This step is very important because it helps the model understand what to learn and how to learn it.Every dataset has two main parts:</p>
<p>- <strong>Features</strong>: These are the input columns. They provide the information used to make predictions.</p>
<p>- <strong>Target</strong>: This is the output column. It contains the values the model needs to learn and predict.</p>

<p>First, the features and the target are separated. This helps the model focus on what to learn from and what to predict.Then, the data is split into two sets:</p>
<p>- One set for <strong>training</strong>: used to teach the model.</p>
<p>- One set for <strong>testing</strong>: used to check how well the model learned.</p>

<p>Common ways to split the data include: 80% training & 20% testing, 70% training & 30% testing, or 60% training & 40% testing.</p>
<p>The split should be random so that every data point has a fair chance. A data point should appear in only one of the two sets.</p>
""", unsafe_allow_html=True)
st.markdown("<h3 style='color:#2a52be;'>Types of Machine Learning Algorithms</h3>", unsafe_allow_html=True)

# Row of 4 ML types
col1, col2, col3, col4 = st.columns(4)

# Helper function to navigate
def nav_to(page_name):
    st.session_state.current_page = page_name

# Supervised
with col1:
    st.markdown("<h4 style='text-align: center; color:#BB3385;'>Supervised</h4>", unsafe_allow_html=True)
    if st.button("Linear Regression"):
        nav_to("Linear Regression")
    if st.button("Logistic Regression"):
        nav_to("Logistic Regression")
    if st.button("Decision Tree"):
        nav_to("Decision Tree")
    if st.button("Random Forest"):
        nav_to("Random Forest")
    if st.button("KNN"):
        nav_to("KNN")
    if st.button("SVM"):
        nav_to("SVM")
    if st.button("Naive Bayes"):
        nav_to("Naive Bayes")

# Unsupervised
with col2:
    st.markdown("<h4 style='text-align: center; color:#BB3385;'>Unsupervised</h4>", unsafe_allow_html=True)
    if st.button("K-Means"):
        nav_to("K-Means")
    if st.button("DBSCAN"):
        nav_to("DBSCAN")
    if st.button("PCA"):
        nav_to("PCA")
    if st.button("Apriori"):
        nav_to("Apriori")

# Semi-Supervised
with col3:
    st.markdown("<h4 style='text-align: center; color:#BB3385;'>Semi-Supervised</h4>", unsafe_allow_html=True)
    if st.button("Self-Training"):
        nav_to("Self-Training")
    if st.button("Label Propagation"):
        nav_to("Label Propagation")

# Reinforcement
with col4:
    st.markdown("<h4 style='text-align: center; color:#BB3385;'>Reinforcement</h4>", unsafe_allow_html=True)
    if st.button("Q-Learning"):
        nav_to("Q-Learning")
    if st.button("SARSA"):
        nav_to("SARSA")
    if st.button("DQN"):
        nav_to("DQN")