Adnan Mehdi

I am a Writer

Adnan Mehdi

I am a passionate AI enthusiast with a strong foundation in programming and technology. Skilled in Python, Java, C++, HTML, and CSS, I enjoy building intelligent solutions and exploring the intersection of code and creativity. With hands-on experience in machine learning basics, I am focused on developing projects that solve real-world problems. Driven by curiosity and innovation, I aim to transform data and algorithms into impactful solutions that contribute to meaningful change.

  • CB-1279, Street no 8, Chour Chowk, Rawalpindi, Pakistan.
  • +92346-802913-8, +92317-052974-0
  • adnanxn34101@gmail.com
Me

My Professional Skills

I specialize in developing intelligent solutions using code and AI, helping businesses and individuals solve problems, automate tasks, and unlock new possibilities through technology.

Audience Understanding 95%
Persuasive Writing 85%
Subject Line Crafting 95%

Software and Web Development

Design and develop responsive websites, software solutions, and applications using HTML, CSS, Python, Java, and C++, bringing ideas to life with clean and functional code.

AI and Automation Solutions

Build beginner-level Machine Learning models and automation scripts to solve real-world problems, optimize workflows, and increase efficiency for businesses or personal projects.

Technical Problem Solving

Offer logical solutions for programming challenges, algorithm design, debugging, and optimizing code across multiple programming languages and platforms.

  • 🧠 Building a Logistic Regression Model with Polynomial Features — Real-World Medical Application

    🧠 Building a Logistic Regression Model with Polynomial Features — Real-World Medical Application

     

    🔍 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)=11+ez\sigma(z) = \frac{1}{1 + e^{-z}}

    🔹 3. Polynomial Feature Mapping

    • Instead of using raw features [x1, x2], we map them to:

      [1,x1,x2,x12,x1x2,x22][1, x1, x2, x1^2, x1 \cdot x2, x2^2]
    • This allows the model to learn curved (non-linear) decision boundaries.

    🔹 4. Cost Function

    • Standard logistic loss:

      J(w,b)=1mi=1m[yilog(fwb)+(1yi)log(1fwb)]J(w, b) = -\frac{1}{m} \sum_{i=1}^{m} [y_i \log(f_wb) + (1 - y_i) \log(1 - f_wb)]

    🔹 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

    Decision Boundary Output


    📁 Project Structure

    plaintext
    logistic-regression-polynomial/ ┣ logistic_diagnosis.py # Main model code ┣ README.md # GitHub readme

    💻 How to Run the Code

    1. Clone the repository:

    bash
    git clone https://github.com/your-username/logistic-regression-polynomial cd logistic-regression-polynomial
    1. Install required libraries:

    bash
    pip install numpy matplotlib
    1. Run the model:

    bash
    python 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

  • Predicting City Profits Using Linear Regression in Python

    Predicting City Profits Using Linear Regression in Python

     


    📍 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:

    PopulationProfit
    4.3711.35
    9.5617.45
    7.5914.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:

    1. Data Loading: The CSV file is loaded using pandas.

    2. Model Initialization: Parameters w (weight) and b (bias) are initialized.

    3. Cost Function: The Mean Squared Error (MSE) is calculated to evaluate predictions.

    4. Gradient Descent: The parameters are updated iteratively to minimize the cost.

    5. 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

    python
    population = 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! 🤖💡

  • 🌍 How I Built Travellix – A Complete Travel Booking Website

    🌍 How I Built Travellix – A Complete Travel Booking Website



    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!


    👉 Comment below your thoughts or suggestions. If you want the full code or step-by-step tutorial, let me know in the comments or contact me directly!



  • GET A FREE QUOTE NOW

    Have questions about fees or need personalized assistance? Feel free to visit my LinkedIn profile for more details and inquiries!

    Powered by Blogger.
    ADDRESS

    CB-1279, Street no 8, Chour Chowk, Rawalpindi, Pakistan

    EMAIL

    adnanxn34101@gmail.com

    MOBILE PHONE

    +92346-802913-8
    +92317-052974-0