# Learn Python & Machine Learning free on Sythra

Free, expert-written concept pages for Python and machine learning. No paywall to read; the AI tutor (Agentic mode) is the optional paid layer.

## Course paths

- [Python Course for Beginners — Learn Python by Building](https://app.sythra.ai/learn/python) — Sythra’s Python course is a free, beginner-friendly path to learn Python by reading clear lessons and practicing with an AI tutor. You start with core syntax and finish ready for data and machine learning.
- [Machine Learning Course — Learn ML by Building](https://app.sythra.ai/learn/machine-learning) — Sythra’s machine learning course teaches ML by building: free expert-written lessons, in-browser practice, and an optional AI tutor that quizzes you until you can explain ideas yourself.

## Lessons

- [Gradient Descent Explained Visually: Mathematics, Update Rules, and Python Implementation](https://app.sythra.ai/learn/machine-learning/gradient-descent-algorithm-visual-explanation-python) — Understand how gradient descent actually works. Learn the calculus of steepest descent, learning rate dynamics, Batch vs. Mini-Batch vs. SGD, and NumPy code.
- [What Is a Loss Function? MSE vs. Cross-Entropy vs. Huber Loss Explained with Math & Python](https://app.sythra.ai/learn/machine-learning/loss-functions-machine-learning-mse-cross-entropy) — Understand loss functions in machine learning. Compare MSE, MAE, Huber Loss, Binary Cross-Entropy, and Categorical Cross-Entropy with derivations, NumPy, and Scikit-Learn code.
- [Epoch vs. Batch Size vs. Iteration in Machine Learning: Differences, Math, and Python Breakdown](https://app.sythra.ai/learn/machine-learning/epoch-batch-size-iterations-machine-learning) — Master the difference between epoch, batch size, and iteration in machine learning. Learn the mathematical formulas, gradient noise dynamics, and Python code examples.
- [Parameters vs. Hyperparameters in Machine Learning: Differences, Math, and Python Examples](https://app.sythra.ai/learn/machine-learning/parameters-vs-hyperparameters-machine-learning-python) — Understand the difference between parameters and hyperparameters in machine learning. Learn the bilevel optimization math, code examples across 5 algorithms, and inspection methods in Python.
- [Customer Segmentation with K-Means Clustering in Python: Complete End-to-End Walkthrough](https://app.sythra.ai/learn/machine-learning/customer-segmentation-kmeans-clustering-python) — Master customer segmentation with K-Means in Python. Learn feature scaling, Elbow Method, Silhouette analysis, cluster profiling, and business persona mapping.
- [Customer Churn Prediction in Python: Complete End-to-End Classification Project](https://app.sythra.ai/learn/machine-learning/customer-churn-prediction-classification-project-python) — Build a complete customer churn prediction model in Python. Master handling class imbalance, precision-recall tradeoffs, threshold tuning, ROC-AUC, and Scikit-Learn pipelines.
- [Predicting House Prices in Python: Complete End-to-End Regression Project Walkthrough](https://app.sythra.ai/learn/machine-learning/predicting-house-prices-regression-machine-learning-project-python) — Build a complete house price prediction regression model in Python. Learn EDA, handling missing data, outlier cleaning, feature engineering, Scikit-Learn pipelines, and model evaluation with RMSE and R2.
- [Cross-Validation Explained From Scratch: K-Fold, Stratified, and Time-Series Splits in Python](https://app.sythra.ai/learn/machine-learning/cross-validation-k-fold-stratified-time-series-python) — Master cross-validation from scratch in Python. Understand K-Fold, Stratified K-Fold, TimeSeriesSplit, GroupKFold, variance reduction math, and avoiding data leakage.
- [Grid Search vs. Random Search vs. Bayesian Optimization: Algorithms, Math, and Python Code](https://app.sythra.ai/learn/machine-learning/grid-search-vs-random-search-vs-bayesian-optimization-python) — Compare Grid Search, Random Search, and Bayesian Optimization for hyperparameter tuning. Understand Gaussian Processes, Expected Improvement (EI), Scikit-Learn code, and tradeoffs.
- [Overfitting vs. Underfitting: Diagnosing Bias-Variance Tradeoffs With Learning Curves in Python](https://app.sythra.ai/learn/machine-learning/overfitting-vs-underfitting-learning-curves-python) — Diagnose overfitting and underfitting using learning curves in Python. Master the bias-variance decomposition, training vs. validation curves, Scikit-Learn code, and practical fixes.
- [t-SNE vs. UMAP: The Mathematics of High-Dimensional Visualization Explained](https://app.sythra.ai/learn/machine-learning/tsne-vs-umap-mathematics-high-dimensional-visualization-python) — Compare t-SNE and UMAP for non-linear dimensionality reduction. Understand conditional Gaussian probabilities, Student-t crowding solutions, fuzzy simplicial sets, cross-entropy vs. KL divergence, and Python code.
- [PCA From Scratch in Python: The Math of Eigenvectors and Dimensionality Reduction Explained](https://app.sythra.ai/learn/machine-learning/pca-from-scratch-eigenvectors-dimensionality-reduction-python) — Master Principal Component Analysis (PCA) from scratch in Python. Learn covariance matrices, eigenvectors, eigenvalues, SVD vs. eigendecomposition, and explained variance with a fully grounded step-by-step mathematical derivation.
- [Isolation Forest for Anomaly Detection in Python: Math, Algorithm, and Code Explained](https://app.sythra.ai/learn/machine-learning/isolation-forest-anomaly-detection-python-math) — Learn how Isolation Forest detects anomalies in Python. Understand isolation trees, BST path length math, c(n) normalization, swamping, and scikit-learn code.
- [Association Rule Mining in Python: Apriori Math, Support, Confidence, and Lift Explained](https://app.sythra.ai/learn/machine-learning/association-rule-mining-apriori-support-confidence-lift-python) — Master Association Rule Mining and the Apriori Algorithm in Python. Learn the math of Support, Confidence, Lift, Conviction, and anti-monotonicity pruning.
- [K-Means Clustering From Scratch in Python: The Algorithm, Math, and Code Explained](https://app.sythra.ai/learn/machine-learning/k-means-clustering-from-scratch-python-math) — Learn how K-Means clustering works from scratch in Python. Understand Euclidean distance assignment, centroid updates, WCSS inertia math, and K-Means++.
- [Handling Imbalanced Datasets in Python: SMOTE, Class Weights, and Math Explained](https://app.sythra.ai/learn/machine-learning/handling-imbalanced-datasets-smote-class-weighting-python) — Master imbalanced datasets in Python. Learn SMOTE math, class weighting in loss functions, leak-free pipelines, PR-AUC metrics, and threshold tuning.
- [Support Vector Machines (SVM) in Python: Margins, Kernels, and Math Explained](https://app.sythra.ai/learn/machine-learning/support-vector-machines-svm-math-python) — Learn how Support Vector Machines (SVM) work in Python. Understand hyperplanes, maximal margins, support vectors, C vs Gamma parameters, the kernel trick, and code.
- [Naive Bayes From Scratch in Python: Math, Bayes' Theorem, and Spam Filter Code](https://app.sythra.ai/learn/machine-learning/naive-bayes-classifier-python-from-scratch) — Learn how Naive Bayes works from scratch in Python. Understand Bayes' Theorem, Laplace smoothing, Multinomial vs Gaussian variants, and code.
- [K-Nearest Neighbors (KNN) in Python: Math, Distance Metrics, and Code](https://app.sythra.ai/learn/machine-learning/knn-k-nearest-neighbors-python-from-scratch) — Learn how the K-Nearest Neighbors (KNN) algorithm works in Python. Understand Euclidean distance, choosing K, feature scaling, and from-scratch code.
- [ROC Curve and AUC in Python: How They Are Calculated Step by Step](https://app.sythra.ai/learn/machine-learning/roc-curve-auc-score-python-explained) — Learn how the ROC Curve and AUC score work in Python. Understand the threshold sweep, trapezoidal rule math, PR-AUC comparison, and code.
- [Confusion Matrix, Precision, Recall, and F1 Score in Python Explained](https://app.sythra.ai/learn/machine-learning/confusion-matrix-precision-recall-f1-python) — Learn how the confusion matrix, precision, recall, specificity, F1 score, and F-beta work in Python. Understand formulas, calculations, and code.
- [Logistic Regression From Scratch in Python: Deriving Sigmoid and Log Loss](https://app.sythra.ai/learn/machine-learning/logistic-regression-from-scratch-sigmoid-loss-python) — Learn how logistic regression works from scratch in Python. Understand the sigmoid derivation, Binary Cross-Entropy log loss, and gradient descent code.
- [Random Forest vs. Gradient Boosting in Python: Ensemble Algorithms From Scratch](https://app.sythra.ai/learn/machine-learning/random-forest-vs-gradient-boosting-python) — Understand Random Forest vs Gradient Boosting in Python. Learn the mathematical difference between Bagging and Boosting, residual fitting, and from-scratch code.
- [Decision Trees From Scratch in Python: The Math of Gini Impurity and Splits](https://app.sythra.ai/learn/machine-learning/decision-trees-from-scratch-gini-splits-python) — Learn how decision trees work from scratch in Python. Understand Gini Impurity, Information Gain, Variance Reduction, and recursive tree building code.
- [RMSE, MAE, and R-Squared in Python: Regression Evaluation Metrics Explained](https://app.sythra.ai/learn/machine-learning/rmse-mae-r-squared-regression-metrics-python) — Understand RMSE, MAE, R-squared, and Adjusted R-squared in Python. Learn the mathematical formulas, outlier sensitivity, and Scikit-Learn code.
- [Ridge, Lasso, and Elastic Net in Python: The Math of Regularization Explained](https://app.sythra.ai/learn/machine-learning/ridge-lasso-elastic-net-regularization-python) — Understand Ridge (L2), Lasso (L1), and Elastic Net regularization in Python. Learn the geometric diamond vs. circle intuition, loss formulas, and Scikit-Learn CV code.
- [Linear Regression From Scratch in Python: Deriving Gradient Descent Step by Step](https://app.sythra.ai/learn/machine-learning/linear-regression-from-scratch-gradient-descent-python) — Master Linear Regression and Gradient Descent from scratch in Python. Learn the MSE cost function, calculus derivation, vectorized NumPy code, and Scikit-Learn benchmarks.
- [Data Leakage in Machine Learning: Types, Detection, and Prevention in Python](https://app.sythra.ai/learn/machine-learning/data-leakage-in-machine-learning-python) — Learn what data leakage is in machine learning, the 4 main types (target, preprocessing, temporal, group), how to catch it in code, and Scikit-Learn Pipeline prevention.
- [Train-Test Split and Cross-Validation in Python: From Scratch to Scikit-Learn](https://app.sythra.ai/learn/machine-learning/train-test-split-and-cross-validation-python) — Master Train-Test Split and K-Fold Cross-Validation in Python. Learn the math, 3-way split, Stratified K-Fold, and Scikit-Learn pipeline code without data leakage.
- [One-Hot Encoding vs Label Encoding in Python: When to Use Which](https://app.sythra.ai/learn/machine-learning/one-hot-encoding-vs-label-encoding-python) — Master One-Hot Encoding vs Label Encoding in Python. Learn when to use which, the math behind fake rankings, dummy variable trap, and Scikit-Learn code.
- [Handling Missing Data in Python: 5 Imputation Methods Explained](https://app.sythra.ai/learn/machine-learning/handling-missing-data-python-imputation-methods) — Learn how to handle missing data in Python using 5 imputation methods — Mean/Median, Forward Fill, KNN, Regression, and MICE with Scikit-Learn code.
- [Feature Engineering in Python: 6 Essential Techniques From Scratch](https://app.sythra.ai/learn/machine-learning/feature-engineering-python-techniques-from-scratch) — Master feature engineering in Python: standardization, min-max scaling, one-hot encoding, log transform, binning, and feature creation with Scikit-Learn code.
- [Data Visualization in Python: Matplotlib and Seaborn, Line by Line](https://app.sythra.ai/learn/machine-learning/data-visualization-python-matplotlib-seaborn) — Learn data visualization in Python with Matplotlib and Seaborn — histograms, boxplots, scatterplots, and bar charts explained line by line with working code.
- [The Statistics Behind Machine Learning: Mean, Variance, and Distributions](https://app.sythra.ai/learn/machine-learning/statistics-behind-machine-learning) — Understand the core statistics used in machine learning — mean, variance, standard deviation, and normal distributions — with worked examples and Python code.
- [Exploratory Data Analysis in Python: A Full Walkthrough on a Real Dataset](https://app.sythra.ai/learn/machine-learning/exploratory-data-analysis-python) — Learn how to do exploratory data analysis (EDA) in Python using Pandas — check missing values, spot outliers with mean and standard deviation, and visualize distributions.
- [The Machine Learning Workflow: A Complete Step-by-Step Pipeline](https://app.sythra.ai/learn/machine-learning/machine-learning-workflow) — Master the complete machine learning workflow — data collection, preprocessing, train-test split, model training, evaluation, and inference with Python and Scikit-Learn.
- [Understanding Features, Labels, and Target Variables in Machine Learning](https://app.sythra.ai/learn/machine-learning/features-labels-target-variables) — A practical guide to Features (X) and Labels (y) in Machine Learning — definitions, feature types, matrix math notation, and step-by-step Pandas splitting code.
- [Supervised vs Unsupervised Learning: The Math and Code](https://app.sythra.ai/learn/machine-learning/supervised-vs-unsupervised-learning) — Understand the core difference between supervised and unsupervised machine learning, complete with intuitive examples, math notation, and Python code.
- [What Is Machine Learning? A Beginner's Guide](https://app.sythra.ai/learn/machine-learning/what-is-machine-learning) — An intuitive, beginner-friendly guide to Machine Learning — how it works, everyday examples, career opportunities, and a complete learning roadmap without math.
- [File Handling in Python (Reading, Writing, CSV & JSON)](https://app.sythra.ai/learn/python/file-handling-python) — Python file handling explained: open() modes, reading line by line, the with statement, CSV and JSON files, and the most common file-handling bugs. Free on Sythra.
- [Pillar Four: Polymorphism in Python](https://app.sythra.ai/learn/python/polymorphism-python) — Python polymorphism explained: duck typing, how len() and print() use dunder methods, operator overloading with __add__/__eq__, and a full 4-pillar OOP example. Free on Sythra.
- [Pillar Three: Abstraction in Python](https://app.sythra.ai/learn/python/abstraction-python) — Python abstraction explained: hiding implementation behind simple methods, Python's abc module, @abstractmethod, and abstraction vs. encapsulation. Free on Sythra.
- [Pillar Two: Inheritance in Python](https://app.sythra.ai/learn/python/inheritance-python) — Python inheritance explained with a Card, Deck, and Hand example: class vs instance attributes, overriding __init__, IS-A vs HAS-A, and debugging with MRO. Free on Sythra.
- [Pillar One: Encapsulation in Python](https://app.sythra.ai/learn/python/encapsulation-python) — Python encapsulation explained: bundling data and behavior, the underscore convention, getters/setters, and @property, with a bank account example. Free on Sythra.
- [The Four Pillars of OOP in Python](https://app.sythra.ai/learn/python/four-pillars-of-oop) — Encapsulation, abstraction, inheritance, and polymorphism explained with a simple coffee machine analogy before diving into Python code. Free on Sythra.
- [Classes and Methods in Python (self, __init__, Operator Overloading)](https://app.sythra.ai/learn/python/classes-and-methods-python) — How to write your own Python methods: self, __init__, __str__, operator overloading with __add__/__radd__, polymorphism, and interface vs. implementation. Free on Sythra.
- [Classes and Functions in Python (Pure Functions vs. Modifiers)](https://app.sythra.ai/learn/python/classes-and-functions-python) — Writing functions that work on custom Python classes: pure functions vs. modifiers, prototype-and-patch vs. planned development, and protecting invariants with assert. Free on Sythra.
- [Classes and Objects in Python](https://app.sythra.ai/learn/python/classes-and-objects-python) — Learn Python classes and objects: defining a class, attributes, embedded objects, passing objects to functions, and the shallow vs deep copy trap. Free on Sythra.
- [More Tools for Iteration in Python](https://app.sythra.ai/learn/python/iteration-tools-python) — continue, pass, the loop else clause, enumerate(), zip(), list comprehensions, iterators, and generators — Python's full iteration toolkit. Free on Sythra.
- [The do-while Equivalent in Python (and Nested Loops)](https://app.sythra.ai/learn/python/do-while-python) — Python has no do-while loop, but while True with break simulates one perfectly. Learn the pattern, input validation, and how nested loops work. Free on Sythra.
- [The for Loop in Python](https://app.sythra.ai/learn/python/for-loop-python) — The for loop in Python explained: looping over ranges, strings, and lists, how range() works with start/stop/step, and when to use for vs while. Free on Sythra.
- [The while Loop in Python](https://app.sythra.ai/learn/python/while-loop-python) — The while loop in Python explained: how it works, infinite loops, break, and a Newton's method square root example with the float comparison trap. Free on Sythra.
- [Prerequisites to Iteration in Python (Variable Updates)](https://app.sythra.ai/learn/python/prerequisites-to-iteration) — What you need before loops in Python: variable reassignment, updates like x = x + 1, and shorthand operators +=, -=, *=, /=. Free on Sythra.
- [Try/Except and Exception Handling in Python](https://app.sythra.ai/learn/python/try-except-python) — Try/except and exception handling in Python explained: catching specific errors, else, finally, raise, and custom exception classes, with a full example. Free on Sythra.
- [The match-case Statement in Python (Python's Switch)](https://app.sythra.ai/learn/python/match-case-python) — Python's match-case statement explained: syntax, the default case (_), matching multiple values with |, and dictionary dispatch as an alternative. Free on Sythra.
- [Recursion in Python](https://app.sythra.ai/learn/python/recursion-in-python) — Recursion in Python explained: base cases, stack frames, factorial and Fibonacci examples, the leap of faith, and avoiding RecursionError. Free on Sythra.
- [Conditionals in Python (if, elif, else)](https://app.sythra.ai/learn/python/conditionals-in-python) — Conditionals in Python explained: if, else, elif chains, the pass statement, and nested conditionals — with tips on flattening nesting. Free on Sythra.
- [Comparison Operators in Python](https://app.sythra.ai/learn/python/comparison-operators-python) — Comparison operators in Python explained: ==, !=, <, >, <=, >=, the modulus operator %, and combining conditions with and, or, not. Free on Sythra.
- [Functions in Python in Depth: The Complete Guide](https://app.sythra.ai/learn/python/python-functions-in-depth) — The complete guide to Python functions: default arguments, keyword arguments, *args, **kwargs, lambda functions, variable scope, and functions as values. Free on Sythra.
- [Built-in Functions in Python](https://app.sythra.ai/learn/python/built-in-functions-python) — Python's built-in functions explained: type(), isinstance(), int/float/str, abs(), round(), max(), min(), sum(), len(), and range() — no import needed. Free on Sythra.
- [Libraries and Modules in Python](https://app.sythra.ai/learn/python/libraries-and-modules-python) — Libraries and modules in Python explained: what import does, from ... import, and the math and random modules with runnable examples. Free on Sythra.
- [Fruitful Functions in Python](https://app.sythra.ai/learn/python/fruitful-functions-python) — Fruitful functions in Python explained: the return statement, incremental development, boolean functions, and dead code — with a distance() worked example. Free on Sythra.
- [Functions in Python: Definition and How They Work](https://app.sythra.ai/learn/python/functions-in-python) — How functions work in Python: calling, defining with def, parameters vs arguments, local variables, and fruitful vs void functions, with runnable examples. Free on Sythra.
- [Type Casting in Python](https://app.sythra.ai/learn/python/type-casting) — Type casting in Python explained: implicit vs explicit casting, int(), float(), str(), bool() conversions, common errors, and truthiness rules. Free on Sythra.
- [Sets in Python](https://app.sythra.ai/learn/python/sets-in-python) — Python sets explained: removing duplicates, fast membership checks, union, intersection, difference, symmetric difference, and frozenset. Free on Sythra.
- [Tuples in Python](https://app.sythra.ai/learn/python/tuples-in-python) — Python tuples explained: immutability, tuple assignment, returning multiple values, *args, zip(), enumerate(), tuples as dict keys, and DSU sorting. Free on Sythra.
- [Dictionaries in Python](https://app.sythra.ai/learn/python/dictionaries-in-python) — Python dictionaries explained: key-value pairs, the histogram counting pattern, dictionary methods, why lists can't be keys, and memoization. Free on Sythra.
- [Lists in Python](https://app.sythra.ai/learn/python/lists-in-python) — Python lists explained: mutability, indexing, slicing, list methods (append, sort, pop, remove), map/filter/reduce, and the aliasing trap. Free on Sythra.
- [Strings in Python](https://app.sythra.ai/learn/python/strings-in-python) — Python strings explained: indexing, len(), negative indices, slicing, immutability, searching, string methods, the in operator, and comparison. Free on Sythra.
- [The input() Function in Python](https://app.sythra.ai/learn/python/python-input-function) — How Python's input() function works: reading user input, adding prompts, why it always returns a string, and converting to int or float safely. Free on Sythra.
- [Interactive Mode vs Script Mode in Python](https://app.sythra.ai/learn/python/interactive-mode-vs-script-mode) — Python interactive mode (REPL) vs script mode explained: why expressions auto-print in one but stay silent in the other, and how to open each. Free on Sythra.
- [Data Types in Python](https://app.sythra.ai/learn/python/data-types) — Python data types explained: int, float, str, bool, list, tuple, dict, set — plus primitive vs non-primitive and mutable vs immutable, with a quick-reference table. Free on Sythra.
- [Order of Operations in Python](https://app.sythra.ai/learn/python/order-of-operations) — Operator precedence in Python — PEMDAS order, parentheses, ** before * /, left-to-right ties, and why degrees / 2 * pi groups the way it does. Free on Sythra.
- [Statements vs Expressions in Python](https://app.sythra.ai/learn/python/statements-vs-expressions) — Python expression vs statement explained: expressions produce values, statements perform actions — and why the REPL shows results your .py script hides until you print(). Free on Sythra.
- [Operators and Operands in Python](https://app.sythra.ai/learn/python/operators-operands) — What operators and operands are in Python — arithmetic, comparison, logical, assignment, membership, and identity — with examples of /, //, %, == vs is. Free on Sythra.
- [Comments in Python](https://app.sythra.ai/learn/python/comments) — How comments work in Python: # line comments, useful vs noisy notes, names vs comments, multiline # blocks, and how triple quotes differ from real comments. Free on Sythra.
- [Variables in Python](https://app.sythra.ai/learn/python/variables) — What variables are in Python: assignment with =, naming rules, snake_case, updates like score += 5, multiple assignment, swap, and light scope — free on Sythra.
- [Types, Values, and Errors in Python](https://app.sythra.ai/learn/python/types-values-errors) — What values and types mean in Python, how type() reveals int, float, and str, and how syntax, runtime, and semantic errors differ — with the classic 1,000,000 trap. Free on Sythra.
- [Programs, Interpreters & Compilers in Python](https://app.sythra.ai/learn/python/programs-interpreters-compilers) — What a program is, how interpreters and compilers translate high-level code, how Python runs in interactive vs script mode, and how bugs and debugging work. Free on Sythra.
- [Logical Operators in Python](https://app.sythra.ai/learn/python/logical-operators) — Logical operators in Python — and, or, not — explained with clear examples, truth tables, short-circuiting, and common mistakes. Free to read on Sythra.
