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("""

Model Building

Welcome to one of the most exciting parts of machine learning – teaching the machine how to learn!

""", unsafe_allow_html=True) st.markdown("""

What is Model Training?

Model training is the process of teaching a machine learning model to understand patterns from data.The model learns with the help of:

β†’ Data – examples that already have correct answers

β†’ Algorithm – a method that helps the model learn from the data

Once the training is complete, the model can start making predictions or decisions on new, unseen data.

""", unsafe_allow_html=True) st.markdown("""

For Example

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("""

Who Are We Actually Training?

We are training machines to learn β€” not robots or humans, but something called a machine learning model.

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.

As programmers, the machine is guided to learn by providing:

β–Ά Data – the examples it should learn from

β–Ά Algorithm – the method it should use to learn from the data

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.

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.

""", unsafe_allow_html=True) st.markdown("""

Picking the Right Learning Style

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.

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

In supervised learning, there are two main types of tasks β€” classification and regression.

β€’ Classification is used when the goal is to predict a category or group.For example: "Yes" or "No", or types like "Apple", "Banana", or "Orange".

β€’ Regression is used when the goal is to predict a number or value.For example: price, temperature, or a score.

The choice depends on the type of output expected β€” category or number.Both are powerful and used in different kinds of problems.

""", unsafe_allow_html=True) st.markdown("""

Preparing and Splitting the Data

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:

- Features: These are the input columns. They provide the information used to make predictions.

- Target: This is the output column. It contains the values the model needs to learn and predict.

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:

- One set for training: used to teach the model.

- One set for testing: used to check how well the model learned.

Common ways to split the data include: 80% training & 20% testing, 70% training & 30% testing, or 60% training & 40% testing.

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.

""", unsafe_allow_html=True) st.markdown("

Types of Machine Learning Algorithms

", 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("

Supervised

", 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("

Unsupervised

", 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("

Semi-Supervised

", 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("

Reinforcement

", 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")