Non-Linear regression
Objectives
- Recall that regression minimizes the sum of squares error
- Recognize that you can minimize the sum of squares error for any function
- Write code that fits a user-defined function to data
- Know that polynomials and splines can be used for interpolation
Background
Non-linear regression fits curves to data. Common examples include exponentials, Gaussians, and sigmoids.
The underlying principle is the same as we described in linear_regression
- define your function using parameters (e.g. slope and intercept)
- calculate the sum of squares
- use optimization to find the combination of parameters that provides the best-fit to your data
These videos should explain the concepts.
Accessing files
See GitHub for instructions on how to download the course material to your local computer.
The source files for this lecture are at <repo>/lectures/non_linear_regression
Other useful material
- Principles of Regression
- the same material as a book
Core materials
- Lecture videos
Single exponential
A demo showing how to fit a single exponential decay to experimental data.
Gaussians
A demo showing how to fit the sum of two Gaussians to data.
Polynomials and splines
A demo showing how to fit polynomials of different degrees, and finally a spline, to data.