search for: best_lambda

Displaying 5 results from an estimated 5 matches for "best_lambda".

2023 Oct 22
1
running crossvalidation many times MSE for Lasso regression
...58,91) x2=c(1,3,2,4,5,6,7,3,8,9,10,11,12,1,3,4,2,3,4,5,4,6,8,7,9,4,3,6,7,9,8,4,7,6,1,3,2,5,6,8,7,1,1,2,9) y=c(2,6,5,4,6,7,8,10,11,2,3,1,3,5,4,6,5,3.4,5.6,-2.4,-5.4,5,3,6,5,-3,-5,3,2,-1,-8,5,8,6,9,4,5,-3,-7,-9,-9,8,7,1,2) T=data.frame(y,x1,x2) z=matrix(c(x1,x2), ncol=2) cv_model=glmnet(z,y,alpha=1) best_lambda=cv_model$lambda.min best_lambda ? ? # Create a list to store the results lst<-list() ? # This statement does the repetitions (looping) for(i in 1?:1000) { ? n=45 ? p=0.667 ? sam=sample(1?:n,floor(p*n),replace=FALSE) ? Training =T [sam,] Testing = T [-sam,] ? test1=matrix(c(Testing$x1,Testing$x2)...
2023 Oct 22
2
running crossvalidation many times MSE for Lasso regression
...,9,10,11,12,1,3,4,2,3,4,5,4,6,8,7,9,4,3,6,7,9,8,4,7,6,1,3,2,5,6,8,7,1,1,2,9) > y=c(2,6,5,4,6,7,8,10,11,2,3,1,3,5,4,6,5,3.4,5.6,-2.4,-5.4,5,3,6,5,-3,-5,3,2,-1,-8,5,8,6,9,4,5,-3,-7,-9,-9,8,7,1,2) > T=data.frame(y,x1,x2) > > z=matrix(c(x1,x2), ncol=2) > cv_model=glmnet(z,y,alpha=1) > best_lambda=cv_model$lambda.min > best_lambda > > > # Create a list to store the results > lst<-list() > > # This statement does the repetitions (looping) > for(i in 1 :1000) { > > n=45 > > p=0.667 > > sam=sample(1 :n,floor(p*n),replace=FALSE) > > Training =T...
2023 Oct 24
1
running crossvalidation many times MSE for Lasso regression
...,5,-3,-5,3,2,-1,-8,5,8,6,9,4,5,-3,-7,-9,-9,8,7,1,2) >> ? ? ? >> >> T=data.frame(y,x1,x2) >> ? ? ? >> >> >> ? ? ? >> >> z=matrix(c(x1,x2), ncol=2) >> ? ? ? >> >> cv_model=glmnet(z,y,alpha=1) >> ? ? ? >> >> best_lambda=cv_model$lambda.min >> ? ? ? >> >> best_lambda >> ? ? ? >> >> >> ? ? ? >> >> >> ? ? ? >> >> # Create a list to store the results >> ? ? ? >> >> lst<-list() >> ? ? ? >> >> >> ?...
2023 Oct 23
1
running crossvalidation many times MSE for Lasso regression
...,4,6,5,3.4,5.6,-2.4,-5.4,5,3,6,5,-3,-5,3,2,-1,-8,5,8,6,9,4,5,-3,-7,-9,-9,8,7,1,2) >? ? ? >> >> T=data.frame(y,x1,x2) >? ? ? >> >> >? ? ? >> >> z=matrix(c(x1,x2), ncol=2) >? ? ? >> >> cv_model=glmnet(z,y,alpha=1) >? ? ? >> >> best_lambda=cv_model$lambda.min >? ? ? >> >> best_lambda >? ? ? >> >> >? ? ? >> >> >? ? ? >> >> # Create a list to store the results >? ? ? >> >> lst<-list() >? ? ? >> >> >? ? ? >> >> # This statement do...
2023 Oct 23
2
running crossvalidation many times MSE for Lasso regression
...,4,6,5,3.4,5.6,-2.4,-5.4,5,3,6,5,-3,-5,3,2,-1,-8,5,8,6,9,4,5,-3,-7,-9,-9,8,7,1,2) > >> >> T=data.frame(y,x1,x2) > >> >> > >> >> z=matrix(c(x1,x2), ncol=2) > >> >> cv_model=glmnet(z,y,alpha=1) > >> >> best_lambda=cv_model$lambda.min > >> >> best_lambda > >> >> > >> >> > >> >> # Create a list to store the results > >> >> lst<-list() > >> >> > >> >> # This statement do...