Liner Regression, Part 2 - Deriving the Univariate case

Mon December 20, 2021
machine-learning linear-regression gradient-descent python

This post is a continuation of a previous post where the cost functions used in linear regression scenarios are used. We will start by revisiting the mean square error (MSE) cost function;

MSE=ni=1(ˆyiyi)2n

which, as explained in the previous post, is

MSE=ni=1(yia0a1xi)2n

The objective is to adjust a0 and a1 such that the MSE is minimized. This is achieved by deriving the MSE with respect to a0 and a1, and finding the minimum case by equating to zero.

MSEa0=0

and

MSEa1=0

Now,

MSEa0=ni=12(yia0a1xi)(1)n

=2nni=1yi+a0+a1xi

At minimum, MSEa0=0, i.e.

2nni=1yi+a0+a1xi=0

ni=1yi+a0+a1xi=0

ni=1yi+ni=1a0+ni=1a1xi=0

ni=1a0+ni=1a1xi=ni=1yi

or

na0+a1ni=1xi=ni=1yi

Similarly,

MSEa1=ni=12(yia0a1xi)(xi)n

=2nni=1(yia0a1xi)(xi)

=2nni=1xiyi+a0xi+a1x2i

At minimum, MSEa1=0, i.e.

2nni=1xiyi+a0xi+a1x2i=0

ni=1xiyi+a0xi+a1x2i=0

ni=1xiyi+a0xi+a1x2i=0

ni=1xiyi+ni=1a0xi+ni=1a1x2i=0

ni=1a0xi+ni=1a1x2i=ni=1xiyi

This can be written in matrix form as

(nni=1xini=1xini=1x2i) (a0a1)= (ni=1yini=1xiy1)

This can be solved using Cramer’s rule. a0=|ni=1yini=1xini=1yixini=1x2i|ni=1nx2i(ni=1xi)2

=ni=1xini=1yini=1xini=1yixini=1nx2i(ni=1xi)2

Similarly,

a1=|nni=1yini=1xini=1xiyi|ni=1nx2i(ni=1xi)2

=nni=1xiyini=1xini=1yini=1nx2i(ni=1xi)2

=ni=1xiyinˉxˉyni=1x2inˉx2

We also note that as,

na0+a1ni=1xi=ni=1yi

na0=ni=1yia1ni=1xi

a0=ni=1yina1ni=1xin

=ˉya1ˉx




Logistic Regression

Derivation of logistic regression
machine-learning

Notes about Azure ML, Part 11 - Model Validation in AzureML

March 9, 2023
machine-learning azure ml hyperparameter tuning model optimization

Paper Implementation - Uncertain rule-based fuzzy logic systems Introduction and new directions-Jerry M. Mendel; Prentice-Hall, PTR, Upper Saddle River, NJ, 2001,    555pp., ISBN 0-13-040969-3. Example 9-4, page 261

October 8, 2022
type2-fuzzy type2-fuzzy-library fuzzy python IT2FS paper-workout


machine-learning 27 python 21 fuzzy 14 azure-ml 11 hugo_cms 11 linear-regression 10 gradient-descent 9 type2-fuzzy 8 type2-fuzzy-library 8 type1-fuzzy 5 cnc 4 dataset 4 datastore 4 it2fs 4 excel 3 paper-workout 3 r 3 c 2 c-sharp 2 experiment 2 hyperparameter-tuning 2 iot 2 model-optimization 2 programming 2 robotics 2 weiszfeld_algorithm 2 arduino 1 automl 1 classifier 1 computation 1 cost-functions 1 development 1 embedded 1 fuzzy-logic 1 game 1 javascript 1 learning 1 mathjax 1 maths 1 mxchip 1 pandas 1 pipeline 1 random_walk 1 roc 1 tools 1 vscode 1 wsl 1