Logistic Regression Explained with Code
Logistic Function
Logistic regression is a generalized linear model, sharing many similarities with multiple linear regression.
We define the logistic function (sigmoid) as:
$$ g(z) = \frac{1}{1 + e^{-z}} $$
With $ z = \theta^T x $, the hypothesis becomes:
$$ h_\theta(x) = \frac{1}{1 + e^{-\theta^T x}} $$
The graph of the logistic function is:
...
Posted on Sun, 07 Jun 2026 17:49:35 +0000 by bals28mjk
Iris Species Classification Using K-Nearest Neighbors Algorithm
Dataset Overview
The Iris dataset, collected by Fisher in 1936, is a widely used classification dataset containing 150 samples from three iris species: Setosa, Versicolor, and Virginica. Each species has 50 samples with four features: sepal length, sepal width, petal length, and petal width.
In machine learning practice, data collection is typi ...
Posted on Mon, 01 Jun 2026 17:37:31 +0000 by 22Pixels
Understanding the K-Nearest Neighbor Algorithm
KNN (K-Nearest Neighbor) Algorithm
KNN is a classification algorithm in supervised learning that stands out because it can be considered both a model-free algorithm and one where the training dataset itself serves as the model.
KNN Algorithm Principles
When predicting a new value, the KNN algorithm determines its class based on the classes of t ...
Posted on Sun, 31 May 2026 17:36:19 +0000 by Rayhan Muktader
Implementing Softmax Regression from Scratch with PyTorch
import torch
# Initialize a tensor with gradient tracking
x = torch.tensor([1.0, 2.0, 3.0, 4.0], requires_grad=True)
# Compute a scalar output
y = 3 * torch.dot(x, x)
# Backpropagation
y.backward()
# Display gradients
print(f"Input tensor: {x}")
print(f"Gradients: {x.grad}")
Gradinet Management
# Zero out gradients b ...
Posted on Wed, 20 May 2026 04:57:19 +0000 by AngusL
Building a Cuisine Recommendation Web App with ONNX and Machine Learning
In this guide, we will build a cuisine recommendation web application that runs a machine learning model directly in the browser. Instead of using a backend server, we will leverage ONNX Web to let users interact with the model through a simple frontend interface.
Cuisine Recommendation Web Application
This project focuses on the machine learni ...
Posted on Mon, 11 May 2026 05:24:42 +0000 by largo
Implementing Decision Tree Classification on MNIST Dataset with Python
Principle Overview
A decsiion tree classifier is a supervised learning algorithm that constructs a tree-like model of decisions based on feature values. The algorithm works by recursively partitioning the dataset into subsets based on the most significant feature that best separates different class labels. Each internal node represents a test o ...
Posted on Thu, 07 May 2026 03:54:56 +0000 by pneudralics