Non-linear Regression

Learn to approximate a function that’s non-linear in its parameters.

Why non-linear regression?

We’ve already seen that we can fit even a non-linear polynomial through data points using linear regression if the function to be approximated was linear in parameters. However, in some cases, linear regression may not fit the data well. In such a case, non-linear regression is preferred. For instance, in a classification problem where the targets are classes (or categories), we may be interested in predicting the probability distribution, bounded between 00 and 11, over all the classes for a given input. If the probability of a class, cc, is p(y^i=cxi)=fw(xi)p(\hat y_i=c|\bold{x_i})=f_\bold{w}(\bold{x_i}), then it’s hard to come up with a function, fwf_\bold{w}, that’s linear with respect to w\bold{w}. The figure below is a pictorial example of such a case, where the number of classes is three and we have to employ non-linear regression to find their probability distribution.

Logistic regression

Consider a classification problem with two classes, where yi{0,1}y_i \in\{0,1\}. Such a problem is also called a binary classification problem. One way of modeling p(y^i=1xi)p(\hat y_i=1|\bold{x_i}) is by using a logistic function as follows:

p(y^i=1xi)=11+exp((xiTw+b))p(\hat y_i=1|\bold{x_i})=\frac{1}{1+\exp(-(\bold{x_i}^T\bold{w}+b))}

p(y^i=0xi)=1p(y^i=1xi)p(\hat y_i=0|\bold{x_i})=1-p(\hat y_i=1|\bold{x_i})

Note: A logistic function is also known as sigmoid, typically denoted as σ(z)\sigma(z).

σ(z)=11+exp(z)\sigma(z)=\frac{1}{1+\exp(-z)}

The range of the sigmoid function is unit interval ...

Sigmoid's output can be treated as a probability