statistics

Statistics tutorials covering core concepts, calculations, and analysis with Python.

ML: Naive Bayes, Probabilistic Classification

Python Naive Bayes is one of the fastest ways to build a working classifier, and this guide explains it from the ground up: Bayes’ theorem in plain English, the “naive” independence assumption, the Gaussian, Multinomial, and Bernoulli variants, and why such a simple algorithm still wins at text classification and spam filtering. “Naive Bayes should not work as well as it does. The independence assumption is almost always wrong, yet the classifier is almost always competitive.” Pedro Domingos, The Master ... Read More

ML: Logistic Regression, Binary and Multi-class

Python logistic regression is the everyday workhorse for classification: the sigmoid function, binary and multi-class problems, reading the output as a real probability, decision boundaries, and knowing when to pick it over other classifiers. “If you can’t get logistic regression to work, don’t bother with neural networks.” Andrew Ng, Stanford CS229 Last Updated: July 2026 | Tested on: Python 3.14.6, scikit-learn 1.9.0 | Difficulty: Intermediate | Reading Time: 14 minutes Linear regression predicts a number. But a lot of real ... Read More

ML: Feature Selection, Drop the Noise, Keep the Signal

You just inherited a dataset with 100 columns and a deadline, and Python feature selection is the calmer answer to both. Instead of feeding every column to your model and hoping for the best, it works out which ones actually matter and quietly drops the rest, so training runs faster and overfits less. Here is how to pick the right method without guessing, using real data at every step. “Perfection is achieved, not when there is nothing more to add, ... Read More