SythraOpen app

Sythra Learn

Learn in the open — free for everyone

Free concept pages for Python and machine learning. No paywall to read. Agentic mode is optional when you want the AI tutor.

Paths

Choose a path

Recent

More to read

View all

Gradient Descent Explained Visually: Mathematics, Update Rules, and Python Implementation

Gradient descent is a first-order iterative optimization algorithm designed to locate the local or global minimum of a differentiable loss function. Because analytical closed-form solutions are computationally infeasible for high-dimensional non-linear models like deep neural networks, gradient descent updates parameters iteratively. At each step, it computes the gradient vector—the direction of steepest loss ascent—and nudges model weights in the exact opposite direction by subtracting a scaled gradient step, governed by the update rule: theta_{t+1} = theta_t - eta * nabla L(theta_t), where eta is the learning rate hyperparameter controlling step size.

16 min readSep 10, 2026

What Is a Loss Function? MSE vs. Cross-Entropy vs. Huber Loss Explained with Math & Python

A loss function is a mathematical operator that quantifies the discrepancy between a model's predicted output and the ground-truth target for a single training observation. By mapping error into a scalar cost, loss functions provide the objective gradient signal required by numerical optimization algorithms (such as gradient descent) to adjust model parameters. In regression tasks, Mean Squared Error (MSE) imposes a quadratic penalty that enforces precision but remains sensitive to outliers, whereas Mean Absolute Error (MAE) and Huber Loss offer linear, robust alternatives. In classification tasks, Binary and Categorical Cross-Entropy derive from Kullback-Leibler divergence, heavily penalizing confident incorrect predictions as predicted probability approaches zero.

16 min readSep 10, 2026

Epoch vs. Batch Size vs. Iteration in Machine Learning: Differences, Math, and Python Breakdown

In machine learning model training, an epoch, batch size, and iteration represent the three fundamental dimensions of the optimization schedule. The batch size B is the number of training observations processed simultaneously in a single forward and backward pass before parameters are updated. An iteration (or step) is one single update of the model's weights computed from one batch. An epoch is one complete traversal through the entire training dataset of N examples. The mathematical relationship governing training is: iterations per epoch equal the ceiling division of dataset size by batch size, I = ceil(N / B), while total parameter updates equal the number of epochs multiplied by iterations per epoch, T = E * ceil(N / B).

15 min readSep 10, 2026

Parameters vs. Hyperparameters in Machine Learning: Differences, Math, and Python Examples

In machine learning, the fundamental distinction between a parameter and a hyperparameter lies in whether the value is learned automatically from training data or configured externally prior to model fitting. A parameter (such as a linear regression slope, decision tree split threshold, or neural network connection weight) is internal to the model and iteratively discovered through an optimization algorithm like gradient descent or the normal equation. In contrast, a hyperparameter (such as regularization strength lambda, maximum tree depth, learning rate eta, or cluster count k) is external to the model, cannot be directly learned from single-dataset training loss without causing catastrophic overfitting, and must be selected through validation techniques like cross-validation, grid search, or Bayesian optimization.

15 min readSep 10, 2026

Customer Segmentation with K-Means Clustering in Python: Complete End-to-End Walkthrough

Customer segmentation with K-Means is an unsupervised machine learning process that partitions an unlabelled customer base into distinct, non-overlapping cohorts based on multi-dimensional behavioral, transactional, and demographic similarity. Rather than relying on static, arbitrary rules, K-Means optimizes the Within-Cluster Sum of Squares (Inertia), iteratively converging centroid coordinates to the geometric centers of high-density customer clusters. A complete enterprise workflow encompasses feature standardization, geometric distance metric calibration, mathematical cluster selection via the Elbow Method and Silhouette analysis, post-hoc persona profiling, and automated real-time cohort scoring for targeted retention and marketing campaigns.

18 min readSep 10, 2026

Customer Churn Prediction in Python: Complete End-to-End Classification Project

Customer churn prediction is a supervised binary classification problem where a model learns historical behavioral patterns, contractual commitments, and engagement telemetry to forecast whether an active subscriber will cancel their service within a designated forward window. A production-grade churn workflow executes across six rigorous stages: exploratory data analysis and class imbalance diagnosis, data preprocessing via leak-free ColumnTransformer pipelines, multi-model cross-validation benchmarking (Logistic Regression, Random Forest, Gradient Boosting), evaluation under asymmetric cost-sensitive metrics (ROC-AUC, PR-AUC, Recall@k, F1-Score), probability calibration with business threshold optimization, and live deployment for automated retention intervention.

20 min readSep 10, 2026

Newsletter

Get new lessons

Free lessons on learning, Python, and ML — no account required. We’ll only email when there’s something worth reading.