# Machine learning lecture 1 course notes  (Page 12/13)

 Page 12 / 13

The third of these assumptions might seem the least well justified of the above, and it might be better thought of as a “design choice” in ourrecipe for designing GLMs, rather than as an assumption per se. These three assumptions/design choices will allow us to derive avery elegant class of learning algorithms, namely GLMs, that have many desirableproperties such as ease of learning. Furthermore, the resultingmodels are often very effective for modelling different types of distributions over $y$ ; for example, we will shortly show that both logistic regression and ordinary least squarescan both be derived as GLMs.

## Ordinary least squares

To show that ordinary least squares is a special case of the GLM family of models, consider the setting where the target variable $y$ (also called the response variable in GLM terminology) is continuous, and we model the conditional distribution of $y$ given $x$ as as a Gaussian $\mathcal{N}\left(\mu ,{\sigma }^{2}\right)$ . (Here, $\mu$ may depend $x$ .) So, we let the $ExponentialFamily\left(\eta \right)$ distribution above be the Gaussian distribution. As we saw previously, in the formulation of the Gaussian as an exponential family distribution, we had $\mu =\eta$ . So, we have

$\begin{array}{ccc}\hfill {h}_{\theta }\left(x\right)& =& E\left[y|x;\theta \right]\hfill \\ & =& \mu \hfill \\ & =& \eta \hfill \\ & =& {\theta }^{T}x.\hfill \end{array}$

The first equality follows from Assumption 2, above; the second equality follows from the fact that $y|x;\theta \sim \mathcal{N}\left(\mu ,{\sigma }^{2}\right)$ , and so its expected value is given by $\mu$ ; the third equality follows from Assumption 1 (and our earlier derivation showing that $\mu =\eta$ in the formulation of the Gaussian as an exponential family distribution); and thelast equality follows from Assumption 3.

## Logistic regression

We now consider logistic regression. Here we are interested in binary classification, so $y\in \left\{0,1\right\}$ . Given that $y$ is binary-valued, it therefore seems natural to choose the Bernoulli family of distributions to model the conditional distribution of $y$ given $x$ . In our formulation of the Bernoulli distribution as an exponential family distribution, we had $\Phi =1/\left(1+{e}^{-\eta }\right)$ . Furthermore, note that if $y|x;\theta \sim \mathrm{Bernoulli}\left(\Phi \right)$ , then $\mathrm{E}\left[y|x;\theta \right]=\Phi$ . So, following a similar derivation as the one for ordinary least squares, we get:

$\begin{array}{ccc}\hfill {h}_{\theta }\left(x\right)& =& E\left[y|x;\theta \right]\hfill \\ & =& \Phi \hfill \\ & =& 1/\left(1+{e}^{-\eta }\right)\hfill \\ & =& 1/\left(1+{e}^{-{\theta }^{T}x}\right)\hfill \end{array}$

So, this gives us hypothesis functions of the form ${h}_{\theta }\left(x\right)=1/\left(1+{e}^{-{\theta }^{T}x}\right)$ . If you are previously wondering how we came up with the form of thelogistic function $1/\left(1+{e}^{-z}\right)$ , this gives one answer: Once we assume that $y$ conditioned on $x$ is Bernoulli, it arises as a consequence of the definition of GLMs and exponential family distributions.

To introduce a little more terminology, the function $g$ giving the distribution's mean as a function of the natural parameter ( $g\left(\eta \right)=\mathrm{E}\left[T\left(y\right);\eta \right]$ ) is called the canonical response function . Its inverse, ${g}^{-1}$ , is called the canonical link function . Thus, the canonical response function for the Gaussian family is just the identify function; and the canonicalresponse function for the Bernoulli is the logistic function. Many texts use $g$ to denote the link function, and ${g}^{-1}$ to denote the response function; but the notation we're using here, inherited from the early machinelearning literature, will be more consistent with the notation used in the rest of the class.

how do we prove the quadratic formular
hello, if you have a question about Algebra 2. I may be able to help. I am an Algebra 2 Teacher
thank you help me with how to prove the quadratic equation
Seidu
may God blessed u for that. Please I want u to help me in sets.
Opoku
what is math number
4
Trista
x-2y+3z=-3 2x-y+z=7 -x+3y-z=6
Need help solving this problem (2/7)^-2
x+2y-z=7
Sidiki
what is the coefficient of -4×
-1
Shedrak
the operation * is x * y =x + y/ 1+(x × y) show if the operation is commutative if x × y is not equal to -1
An investment account was opened with an initial deposit of $9,600 and earns 7.4% interest, compounded continuously. How much will the account be worth after 15 years? Kala Reply lim x to infinity e^1-e^-1/log(1+x) given eccentricity and a point find the equiation Moses Reply 12, 17, 22.... 25th term Alexandra Reply 12, 17, 22.... 25th term Akash College algebra is really hard? Shirleen Reply Absolutely, for me. My problems with math started in First grade...involving a nun Sister Anastasia, bad vision, talking & getting expelled from Catholic school. When it comes to math I just can't focus and all I can hear is our family silverware banging and clanging on the pink Formica table. Carole I'm 13 and I understand it great AJ I am 1 year old but I can do it! 1+1=2 proof very hard for me though. Atone Not really they are just easy concepts which can be understood if you have great basics. I am 14 I understood them easily. Vedant hi vedant can u help me with some assignments Solomon find the 15th term of the geometric sequince whose first is 18 and last term of 387 Jerwin Reply I know this work salma The given of f(x=x-2. then what is the value of this f(3) 5f(x+1) virgelyn Reply hmm well what is the answer Abhi If f(x) = x-2 then, f(3) when 5f(x+1) 5((3-2)+1) 5(1+1) 5(2) 10 Augustine how do they get the third part x = (32)5/4 kinnecy Reply make 5/4 into a mixed number, make that a decimal, and then multiply 32 by the decimal 5/4 turns out to be AJ how Sheref A soccer field is a rectangle 130 meters wide and 110 meters long. The coach asks players to run from one corner to the other corner diagonally across. What is that distance, to the nearest tenths place. Kimberly Reply Jeannette has$5 and \$10 bills in her wallet. The number of fives is three more than six times the number of tens. Let t represent the number of tens. Write an expression for the number of fives.
What is the expressiin for seven less than four times the number of nickels
How do i figure this problem out.
how do you translate this in Algebraic Expressions
why surface tension is zero at critical temperature
Shanjida
I think if critical temperature denote high temperature then a liquid stats boils that time the water stats to evaporate so some moles of h2o to up and due to high temp the bonding break they have low density so it can be a reason
s.
Need to simplify the expresin. 3/7 (x+y)-1/7 (x-1)=
. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?
Got questions? Join the online conversation and get instant answers!