Have you ever wondered how deep learning models classify data into multiple categories? I recently built a softmax classification model using TensorFlow and Keras to explore this very concept — and the results were both visually and technically rewarding!
In this project, I worked with a custom 2D dataset containing data points labeled into 10 different classes (0–9). My goal was to train a model that could not only accurately classify the data but also visually demonstrate the decision boundaries created by the softmax layer.
🔍 What the Model Does:
-
Takes 2 features as input
-
Uses a hidden layer with ReLU activation
-
Outputs predictions through a softmax layer (for 10 classes)
-
Trains the model and visualizes decision boundaries
📊 What I Learned:
-
How to handle label mismatches (e.g., label "9" but only 3 output units? Oops!)
-
Why softmax activation is ideal for multi-class problems
-
The importance of good data visualization before and after training
🛠️ Technologies Used:
-
Python
-
TensorFlow / Keras
-
NumPy
-
Matplotlib
📁 Check It Out on GitHub:
🔗 GitHub Repository:
https://github.com/AdnanCodes-hub/DEEPLEARNING.SOFTMAX
Feel free to explore the code, run the model, and even experiment with your own dataset. If you're a beginner in machine learning or looking to reinforce your knowledge of classification, this project can be a great reference.
Let me know your thoughts or feedback — and happy coding! 💻🧠
🔍 Introduction
In real-life scenarios like medical diagnosis, classifying patients as healthy or diseased often involves complex relationships between multiple biological indicators. These relationships are non-linear, which means a straight line (linear model) simply isn’t good enough. To tackle this, I designed a Logistic Regression model with Polynomial Features that can handle such non-linear decision boundaries with high accuracy.
In this blog post, I’ll walk you through:
-
What I built and why
-
How I created synthetic but realistic data
-
The algorithms and techniques I used
-
The results, visualization, and GitHub repository
🔗 GitHub Repository:
👉 Logistic Regression with Polynomial Features
🏥 Real-World Analogy: A Medical Diagnosis System
Imagine a simple system that predicts whether a patient is sick or healthy based on two lab test results (e.g., X1 = blood sugar, X2 = blood pressure). If the symptoms follow a circular or ring-shaped pattern (which is common when data clusters form), we need something more powerful than a straight-line model.
That’s where Polynomial Logistic Regression comes in.
📘 Techniques and Algorithms Used
Here are all the techniques and components that make up this project:
🔹 1. Data Generation (Synthetic Medical Data)
-
Two features per sample (X1 and X2)
-
100 total samples:
-
Class 0 (Healthy) → Clustered near the center (inner circle)
-
Class 1 (Diseased) → Spread in an outer ring
-
🔹 2. Logistic Regression Model
-
Binary Classification using the Sigmoid function:
σ(z)=1+e−z1
🔹 3. Polynomial Feature Mapping
-
Instead of using raw features
[1,x1,x2,x12,x1⋅x2,x22][x1, x2], we map them to: -
This allows the model to learn curved (non-linear) decision boundaries.
🔹 4. Cost Function
-
Standard logistic loss:
J(w,b)=−m1i=1∑m[yilog(fwb)+(1−yi)log(1−fwb)]
🔹 5. Gradient Descent Optimization
-
I implemented gradient descent manually to minimize the cost:
-
Compute gradients: ∂J/∂w and ∂J/∂b
-
Update weights iteratively using learning rate
α = 0.01 -
Total iterations: 10,000
-
🔹 6. Accuracy Evaluation
-
The model achieved ~95% to 100% training accuracy, depending on the random seed.
🔹 7. Visualization
-
Scatter plot of the original dataset
-
Decision boundary plotted using a contour plot
-
Clearly shows the model has learned a curved boundary that separates both classes effectively
🧪 Results
-
✅ Training Accuracy: ~95%–100%
-
🟦 Class 1 (Diseased): Blue circles
-
🟥 Class 0 (Healthy): Red crosses
-
📈 Decision Boundary: Curved yellow line
-
🔍 Boundary learned only because of polynomial features; without them, the model would fail

📁 Project Structure
plaintextlogistic-regression-polynomial/ ┣ logistic_diagnosis.py # Main model code ┣ README.md # GitHub readme
💻 How to Run the Code
-
Clone the repository:
bashgit clone https://github.com/your-username/logistic-regression-polynomial
cd logistic-regression-polynomial
-
Install required libraries:
bashpip install numpy matplotlib
-
Run the model:
bashpython logistic_diagnosis.py
You’ll see both the original dataset and the decision boundary plotted.
💬 Conclusion
This project demonstrates how basic algorithms, when combined with feature engineering (like polynomial expansion), can solve non-linear classification problems — just like a real-world medical diagnosis system might require. Everything was implemented from scratch, without relying on any machine learning libraries like Scikit-learn or TensorFlow.
💡 What’s Next?
-
Add L2 regularization to prevent overfitting
-
Try degree 3 or 4 polynomials
-
Build a web interface (Flask/Streamlit) to test predictions
-
Test on real-world healthcare datasets
📍 Introduction
Have you ever wondered how businesses can predict their profits based on the population of a city? Using Supervised Learning, specifically Linear Regression, we can build a simple yet powerful model that learns from past data and makes predictions for future inputs. 🚀
In this blog, I’ll walk you through a project where a Linear Regression model was trained on a dataset of city populations and their corresponding profits. The goal? To predict future profits for a business by simply inputting the population of a new city.
📂 Dataset
The dataset consists of 100 samples, each containing:
-
Population (in 10,000s)
-
Profit (in $10,000s)
Here’s a glimpse of the data:
| Population | Profit |
|---|---|
| 4.37 | 11.35 |
| 9.56 | 17.45 |
| 7.59 | 14.43 |
This data follows a linear trend with some noise — perfect for a supervised learning task.
🔧 Model Training
Using Python, NumPy, and a bit of linear algebra, I trained a Linear Regression model with the following steps:
-
Data Loading: The CSV file is loaded using
pandas. -
Model Initialization: Parameters
w(weight) andb(bias) are initialized. -
Cost Function: The Mean Squared Error (MSE) is calculated to evaluate predictions.
-
Gradient Descent: The parameters are updated iteratively to minimize the cost.
-
Prediction: Once trained, the model predicts profits based on new population values.
💻 Try It Yourself
You can view the full source code, dataset, training logic, and prediction demo here:
👉 🔗 GitHub Repository: Machine Learning Profit-Population Model
Feel free to clone the repo, run the notebook, and experiment with your own population values.
📈 Sample Prediction
pythonpopulation = 7.5 # in 10,000s
predicted_profit = w * population + b
print(f"Predicted profit: ${predicted_profit * 10000:.2f}")
When entering a population of 75,000, the model might predict a profit of around $125,000, depending on the final trained weights.
📚 Conclusion
This project is a classic example of Supervised Learning — training a model on labeled data to predict outcomes. It demonstrates how a simple linear model can help businesses make data-driven decisions.
If you're a beginner in machine learning or data science, this is a perfect project to understand the fundamentals of:
-
Data preprocessing
-
Gradient descent
-
Cost function optimization
-
Real-world applications of ML
💬 Got questions or want to collaborate? Drop a comment on GitHub or connect with me on LinkedIn!
Happy Learning! 🤖💡
Introduction
Have you ever dreamed of creating a website that not only looks great but also functions as a real service? That’s exactly what I did with Travellix, my own travel booking platform. With the help of AI and my web development skills, I’ve created a website where users can explore travel packages, book trips, write reviews, and manage their bookings—all in one place.
This blog post shares how I built it, the features I added, the challenges I faced, and how it works behind the scenes.
🌐 Features of Travellix
Travellix is designed to be simple yet powerful. Here’s what it offers:
✅ Dynamic Travel Packages – Pulled directly from the database so every update is reflected instantly on the website.
✅ Secure Booking System – Users can fill out a booking form to confirm their trips.
✅ Review System – Visitors can leave reviews, which are displayed on the website in real-time.
✅ User Authentication – Includes Login, Sign Up, and Logout features for a personalized experience.
✅ Responsive Multi-Page Website – Fully functional pages: Home, Booking, Contact Us, Reviews, Login, and Sign Up.
🛠️ Tech Stack Used
-
Frontend: HTML5, CSS3, JavaScript
-
Backend: PHP
-
Database: MySQL
-
Tools: VS Code, XAMPP, phpMyAdmin
🔗 How the Website Works (Backend Overview)
The website dynamically fetches travel packages from the MySQL database. Whenever a new package is added in the database, it instantly appears on the homepage.
🔧 Example Code to Fetch Packages:
php<?php
include 'connection.php';
$query = "SELECT * FROM packages";
$result = mysqli_query($conn, $query);
while($row = mysqli_fetch_assoc($result)){
echo "<div class='package'>";
echo "<h2>".$row['destination']."</h2>";
echo "<p>".$row['description']."</p>";
echo "<p>Price: ".$row['price']."</p>";
echo "</div>";
}
?>
📝 Review Submission Feature:
Users can submit their travel experiences, and these reviews are stored in the database. On the same Reviews page, all submitted reviews are displayed dynamically.
🔒 Authentication Feature:
The Sign Up and Login pages are designed to securely handle user information. Only logged-in users can make bookings or submit reviews.
📑 Booking Form Functionality:
-
Users select a destination, enter their details (name, date, contact info), and submit the form.
-
Data is stored in the bookings table in the database.
🔗 Sample Booking Form Code Snippet:
html<form action="booking.php" method="POST">
<input type="text" name="name" placeholder="Your Name" required>
<input type="email" name="email" placeholder="Email" required>
<select name="destination">
<option value="Maldives">Maldives</option>
<option value="Dubai">Dubai</option>
<!-- Add more destinations -->
</select>
<input type="date" name="travel_date" required>
<button type="submit">Book Now</button>
</form>
⚙️ Database Structure:
The website is powered by a MySQL database that contains several key tables:
-
packages– Stores destination info, description, and price. -
users– Stores user login details. -
reviews– Stores customer reviews. -
bookings– Stores booking details.
❗ Challenges I Faced:
-
Setting up the connection between PHP and MySQL.
-
Handling form validations and data security.
-
Making the website responsive across devices.
-
Designing a clean UI/UX that’s easy for users to navigate.
🌟 What I Learned:
Building Travellix improved my skills in:
-
Frontend and backend integration.
-
Database handling.
-
Managing user sessions and authentication.
-
Real-world project deployment structure.
🚀 Conclusion
Travellix isn’t just a project—it's a reflection of my growth as a developer. It shows how a simple idea, with dedication and the right tools, can turn into a fully functional product.
If you’re interested in seeing it in action, visit the website and explore the travel packages. You can even try booking a package or leaving a review to test how it works!






