Question: Let Y be a random variable that takes values in { 0 , 1 } . We assume that there exist 0 inR and i

Let Y be a random variable that takes values in {0,1}. We assume that there exist
0inR and inRp such that the conditional probability P(Y=1|x) given for
each xinRP can be expressed by
log(P(Y=1|x)P(Y=0|x))=0+x
(logistic regression).
(a) Prove that (2.22) can be expressed by
P(Y=1|x)=exp(0+x)1+exp(0+x)
(b) Let p=1 and 0=0. The following procedure draws the curves by com-
puting the right-hand side of (2.23) for various inR. Fill in the blanks and
execute the procedure for =0. How do the shapes evolve as grows?
def f(x):
return (np.axp(beta_0+ np.dot (beta, x))
/(1+ np-axp(beta_0+ np.dot (beta, x))))
beta_0=0
beta_seq = np.array ([0,0.2,0.5,1,2,10])
a = len(beta_seq)
x = np.aranga (-10,10)
for 1 in range(a):
bata = ## Blank(l) ##
plt.plot(## Blank(2) ##, label=beta_seg[ij)
plt-t1tle("Log1st1c_Curve")
plt.xlabal("$x3")
plt - ylabol("3P(Y=1|x)3")
P1t. logend ()
(c) For logistic regression (2.22), when the realizations xinRp and Yin{0,1}
are (xi,yi)(i=1,dots,N), the likelihood is given by prodi=1Neyi[0+xi]1+e0+xi. In its
Lasso evaluation
-1Ni=1N[yi(0+xi)-log(1+e1+xi)]+||||1
Y takes values in {0,1}. However, an alternative expression as in (2.25) is
often used, in which Y takes values in {-1,1} : 1Ni=1Nlog(1+exp(-yi(0+xi)})+||||1
Show that if we replace yi=0 with yi=-1, then (2.24) is equivalent to
(2.25).
Hereafter, we denote by xinRN(p+1) the matrix such that the (i,j) th element
is xi,j for j=1,dots,p and the leftmost column (the 0 th column) is a vector
consisting of N ones, and let xi=[xi,1,dots,xi,p]. We assume that the random
variable Y takes values in {-1,1}.
Let Y be a random variable that takes values in {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!