TheElementofStatisticalLearning{Chapter7oxstar@SJTUJanuary6,2011Ex.7.1Derivetheestimateofin-sampleerror(7.24).Ey(Errin)=Ey(err)+2dN2AnswerNXi=1Cov(^yi;yi)=trace(Cov(^Y;Y))=trace(Cov(HY;Y))//H=X(XTX) 1XT=trace(HCov(Y;Y))=trace(HVar(Y))=2trace(H)=2trace(X(XTX) 1XT)=2trace(XTX(XTX) 1)=2trace(Id)=d2SowehaveEy(Errin)=Ey(err)+2NNXi=1Cov(^yi;yi)=Ey(err)+2dN2Ex.7.3Let^f=Sybealinearsmoothingofy.1.IfSiiistheithdiagonalelementofS,showthatforSarisingfromleastsquaresprojectionsandcubicsmoothingsplines,thecross-validatedresidualcanbewrittenasyi ^f i(xi)=yi ^f(xi)1 Sii:(7.64)2.Usethisresulttoshowthatjyi ^f i(xi)jjyi ^f(xi)j.3.FindgeneralconditionsonanysmootherStomakeresult(7.64)hold.Proof1.Sarisesfromleastsquaresprojectionsandcubicsmoothingsplines,sowecanassumeS=X(XTX+) 1XT=XA 1XTHenceSii=xTi(XTX+) 1xi=xTiA 1xi^f(xi)=xTi(XTX+) 1XTy=xTiA 1XTy1whereA=XTX+.DenotebyX iandy ithecorrespondingresultswithxiremoved,thenwehave^f i(xi)=xTi(XT iX i+) 1XT iy i=xTi(XTX xixTi+) 1(XTy xiyi)=xTi(A xixTi) 1(XTy xiyi)(1)(7.64)equalsto^f i(xi)=yi yi ^f(xi)1 Sii=^f(xi) yiSii1 Sii(2)Toprove(1)=(2),weshouldproposealemma(A xxT) 1=A 1+A 1xxTA 11 xTA 1x(3)Proof.(A xxT)(A 1+A 1xxTA 11 xTA 1x)=I+xxTA 11 xTA 1x xxTA 1 xxTA 1xxTA 11 xTA 1x=I+xxTA 1 xxTA 1+xxTA 1xTA 1x xxTA 1xxTA 11 xTA 1x=I+xxTA 1(xTA 1x) x(xTA 1x)xTA 11 xTA 1x=IHerewecancontinuederiving(1)f i(xi)=xTiA 1+A 1xixTiA 11 xTiA 1xi(XTy xiyi)//from(3)=xTiA 1+SiixTiA 11 Sii(XTy xiyi)(4)=xTiA 1XTy xTiA 1xiyi+SiixTiA 1XTy1 Sii SiixTiA 1xiyi1 Sii=^f(xi) yiSii+Sii^f(xi)1 Sii yiS2ii1 Sii=(2)2.(XT iX i+) 1ispositive-semidenite,sowehavexTi(XT iX i+) 1xi=xTiA 1+SiixTiA 11 Siixi//from(1)(4)=Sii+S2ii1 Sii=Sii1 Sii0)0Sii1yi ^f i(xi)=yi ^f(xi)1 Siiyi ^f(xi)3.Iftherecipeforproducing^ffromydoesnotdependonyitselfandSdependsonlyonthexiand,wecanjustreplaceyiwith^f i(xi)iny(y!y0)withoutSbeingchangedinthe2secondprocess.Notethat^f i(xi)hereiscalculatedbytherstprocess.Hencewestillhave^f i(xi)=Siy0=Xi6=jSijy0j+Sii^f i(xi)=^f(xi) Siiyi+Sii^f i(xi)(7.64)canalsobederivedfromthisequation.SothegeneralconditionsonanysmootherStomakeresult(7.64)holdaretherecipeforproducing^ffromydoesnotdependonyitselfandSdependsonlyonthexiand.Ex.7.4Considerthein-samplepredictionerror(7.18)andthetrainingerrorerrinthecaseofsquared-errorloss:Errin=1NNXi=1EY0(Y0i ^f(xi))2err=1NNXi=1(yi ^f(xi))2:Addandsubtractf(xi)andE^f(xi)ineachexpressionandexpand.Henceestablishthattheaverageoptimisminthetrainingerroris2NNXi=1Cov(^yi;yi);asgivenin(7.21).ProofBecauseY0andyhavethesamedistribution,wehaveEY0(Y0i)=Ey(yi)andobviouslyEY0[(Y0i)2]=Ey(y2i).HenceEy(op)=Ey(Errin err)=1NNXi=1Ey[EY0(Y0i ^f(xi))2 (yi ^f(xi))2]=1NNXi=1Ey[EY0(Y0i)2 2^yiEY0(Y0i)+^y2i y2i+2yi^yi ^y2i]=1NNXi=1[EY0[(Y0i)2] 2Ey(^yi)EY0(Y0i) Ey(y2i)+2Ey(yi^yi)]=1NNXi=1[Ey(y2i) 2Ey(^yi)Ey(yi) Ey(y2i)+2Ey(yi^yi)]=2NNXi=1[Ey(yi^yi) Ey(^yi)Ey(yi)]=2NNXi=1Cov(^yi;yi)Ex.7.5Foralinearsmoother^y=Sy,showthatNXi=1Cov(^yi;yi)=trace(S)2;whichjustiesitsuseastheeectivenumberofparameters.3ProofNXi=1Cov(^yi;yi)=trace(Cov(^y;y))=trace(Cov(Sy;y))=trace(SCov(y;y))=trace(SVar(y))=trace(S)2Ex.7.6Showthatforanadditive-errormodel,theeectivedegrees-of-freedomforthek-nearest-neighborsregressiontisN=k.ProofBythedenitionofk-nearest-neighbortfor^Y,wehave^Y(x)=1kXxi2Nk(x)yi=1kINyHencetheeectivedegrees-of-freedomdf(S)=trace(S)=trace(1kIN)=NkEx.7.8ShowthatthesetoffunctionsfI(sin(x)0)gcanshatterthefollowingpointsontheline:z1=10 1;:::;z`=10 `;forany`.HencetheVCdimensionoftheclassfI(sin(x)0)gisinnite.ProofIfweclassifyz`tosin(z`)0,thenwehave2k10 `2(k+12)(5)2k10`2(k+12)10`(6)Weshoulddeterminekthatsatisestheinequality(6)aboveforany`.Letk=Xm2L;ml10m l2+122Xm2L10m22Xm2L10m2+12whereListhesetof`.4Nowwecanproveinequality(5)foranyl2L.10 l2Xm2L10m l2=2Xm2L;m6=l10m l2+122Xm2L;ml10m l2+12=2k10 l2Xm2L10m l2+10 l2=2Xm2L;ml10m l2+12+Xm2L;ml10m l2+10 l22Xm2L;ml10m l2+12+1Xi=110 i2(7)2Xm2L;ml10m l2+12+12=2(k+12)(8)Ifl=2L,wehave10 l2Xm2L10m l2=2Xm2L;ml10m l2+Xm2L;ml10m l2=2Xm2L;ml10m l2+12 12+Xm2L;ml10m l22Xm2L;ml10m l2+12 12=2(k 12)10 l2Xm2L10m l2+10 l2=2Xm2L;ml10m l2+Xm2L;ml10m l2+10 l22Xm2L;ml10m l2+12=2k//from(7)(8)Obviously,sin(zl)0,hencewecanshatterallpointsontheline.5