What is “learning” and do we have a formal model for it? I’ve decided to dive into the theoretical underpinnings of machine-learning, so here’s a quick introduction to...
Hypothesis testing and p-values are often misused and misunderstood. In this article, I explain what a p-value is, and how to use it.
We introduce the basic vocabulary required to understand hypothesis testing and define the p-value.
The maximum likelihood estimator is one of the most used estimators in statistics. In this article, we introduce this estimator and study its properties.
We show that the MLE is obtained by minimizing the KL-divergence from an empirical distribution and interpret what it means.
In this article we define what an estimator is. We focus on the theory to compare and assess estimators, rather than how to find one.
A ridge regression is an OLS regression that uses L2-regularization.
In this article, we discuss the impact of L2-regularization on the estimated parameters of a linear model.
Regularization is a semi-automated method to manage overfitting. The core idea is to avoid overfitting by penalizing model complexity.
The problem of fitting a model to data differs from the problem of finding patterns that generalize to new data.
In this article, we define underfitting and overfitting
A polynomial regression is a linear regression where the input vectors have been preprocessed using polynomial basis expansion.
Polynomial basis expansion, also called polynomial features augmentation, is part of the machine-learning preprocessing. It consists in adding powers of the input’s components to the input vector.
We’ve just fitted OLS to our trainset. How to assess whether it was a good model to use? We will answer this question from the point of view...
The mean squared error loss quantifies the error between a target variable and an estimate for its value.
The MSE loss is attractive because the expected error in prediction can be explained by the bias-variance of the model and the variance of the noise. This is...
The MSE loss is attractive because the expected error in estimation can be explained by the bias and the variance of the model. This is called the bias-variance...
A least-squares regression, often called ordinary least squares (OLS), is a linear regression model that uses the mean squared-error loss function (MSE loss).
We will show that the loss function used by ordinary least-squares (OLS) stems from the statistical theory of maximum likelihood estimation applied to the normal distribution.
A linear regression attempts to estimate an output value using a linear function. Those functions can be expressed concisely using the vector notations. In this article, we define...
A linear regression is a model used to predict the value of a (continuous) variable.
The train error is the error commited by a machine-learning model on the dataset it was trained on. The test error is the error commited on another dataset...
In machine-learning, a target value is an output value to a supervised learning problem.
Types of convergence
The residual is the error vector between the true output vector and its estimate :
An hyperparameter is a parameter of the machine-learning algorithm. While the parameters are learned by the machine-learning algorithm, an hyperparameter dictates how the algorithm learns.
In machine-learning, a feature is an input variable to a supervised learning problem.
Given our usual dataset made of input vectors and output values, the design matrix is the matrix whose rows are the input vectors.
In a classification problem, the dataset consists of pairs of input vectors and discrete labels :
In this article, we explain that a statistic is a way of compressing information contained in the data, and we show how it can be used for inference....
A summary about scalar and vector derivatives.
A Logistic regression is a generalized linear model which is tailored to classification. In this article, we introduce this regression and explain its origin.
To understand what a generalized linear model does, let’s look back at linear models.
In this article we study the solution to a regression with squared error loss. We start with the theoretical formulation before tackling the problem in practice.
In this article, I show that the normal equations define the orthogonal projection of a vector onto a linear subspace.
The normal equations arise in several branches of mathematics, from statistics to geometry. In this article, we discuss how they emerge and how to solve them.
The Moore-Penrose inverse of a matrix is used to approximatively solve a degenerate system of linear equations.
Stochastic gradient descent is an algorithm that tries to find the minimum of a function expressed as a sum of component functions. It does so by choosing a...
Gradient descent is an optimization algorithm that tries to find the minimum of a function by following its gradient.
In machine learning, the best parameters for a model are chosen so as to minimize the training objective. Strictly convex functions are paticularly interesting because they have a...
We will use the
whoosh library to store and search our local database.
Install the library with
Since the goal is to provide an interface to download, store and manage ebooks, we will now tackle the downloading part.
We will scrape the website GoodReads to perform our search.
Let’s tackle the providers.
pip install unidecode
This morning I spent over an hour sorting and renaming the ebooks I downloaded this year. There were over 300 ebooks. What a waste of my time.
Scrapy is one of the most popular Python framework for large scale web scraping. It gives you all the tools you need to efficiently extract data from websites,...
Scraping means using a program to extract data from a source. When the source is a website or a blog, we say web scraping, and today we will...
You’ve just quickly crafted a python script, and you ready to let it run the whole night while you sleep. Not long after you’ve fallen asleep, an error...
In this article we will derive the normal distribution as the probability distribution that models measurement errors. We start with a dart game and follow Herschel’s derivation.
This article shows geometrically where the best estimates for the mean and variance of a normally distributed random vector can be found. We start with a simple question...
In this article, I will apply the rules of probability calculus to derive the rules of propositional logic (also called propositional calculus).
In a previous article I showed that the inference rules of propositional logic can be obtained from probability calculus. But actually, we can obtain much more, and...
This article sketches a construction of probability calculus as an extension of classical logic to account for uncertainty so that by construction, it can be used to automate...
In 1948, Claude Shannon invented information theory based on probability theory. The basic definition is entropy. Given of a set of messages mi, each one occurring with probability...
Probability is not a property of an event or state; there is no such thing as the probability that the coin lands showing head. Probability expresses a strength...
This article explains the intuition behind the change of basis matrix.
This article explains in simple terms the purpose of statistical theory and gives an overview of how it is used.
Statistics, probability theory and machine learning are often confused. This article tackles the difference between statistics and probability and their difference with machine learning. We will see that...
Data is the new oil. Everyone talks about data and Data Scientist is even said to be the sexiest job of the 21st century. But what’s all that...