Displaying 5 results from an estimated 5 matches for "predictlasso".
2023 Oct 24
1
running crossvalidation many times MSE for Lasso regression
...; >>
>> ? ? ? >> >> Training =T [sam,]
>> ? ? ? >> >> Testing = T [-sam,]
>> ? ? ? >> >>
>> ? ? ? >> >> test1=matrix(c(Testing$x1,Testing$x2),ncol=2)
>> ? ? ? >> >>
>> ? ? ? >> >> predictLasso=predict(cv_model, newx=test1)
>> ? ? ? >> >>
>> ? ? ? >> >>
>> ? ? ? >> >> ypred=predict(predictLasso,newdata=test1)
>> ? ? ? >> >> y=T[-sam,]$y
>> ? ? ? >> >>
>> ? ? ? >> >> MSE = mean...
2023 Oct 22
1
running crossvalidation many times MSE for Lasso regression
...ambda.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),ncol=2)
?
predictLasso=predict(cv_model, newx=test1)
?
?
ypred=predict(predictLasso,newdata=test1)
y=T[-sam,]$y
?
MSE = mean((y-ypred)^2)
MSE
lst[i]<-MSE
}
mean(unlist(lst))
##################################################################?
?
?
?
2023 Oct 22
2
running crossvalidation many times MSE for Lasso regression
...<-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),ncol=2)
>
> predictLasso=predict(cv_model, newx=test1)
>
>
> ypred=predict(predictLasso,newdata=test1)
> y=T[-sam,]$y
>
> MSE = mean((y-ypred)^2)
> MSE
> lst[i]<-MSE
> }
> mean(unlist(lst))
> ##################################################################
>
>
>
>
> ____...
2023 Oct 23
1
running crossvalidation many times MSE for Lasso regression
...*n),replace=FALSE)
>? ? ? >> >>
>? ? ? >> >> Training =T [sam,]
>? ? ? >> >> Testing = T [-sam,]
>? ? ? >> >>
>? ? ? >> >> test1=matrix(c(Testing$x1,Testing$x2),ncol=2)
>? ? ? >> >>
>? ? ? >> >> predictLasso=predict(cv_model, newx=test1)
>? ? ? >> >>
>? ? ? >> >>
>? ? ? >> >> ypred=predict(predictLasso,newdata=test1)
>? ? ? >> >> y=T[-sam,]$y
>? ? ? >> >>
>? ? ? >> >> MSE = mean((y-ypred)^2)
>? ? ? >> >...
2023 Oct 23
2
running crossvalidation many times MSE for Lasso regression
...*n),replace=FALSE)
> >> >>
> >> >> Training =T [sam,]
> >> >> Testing = T [-sam,]
> >> >>
> >> >> test1=matrix(c(Testing$x1,Testing$x2),ncol=2)
> >> >>
> >> >> predictLasso=predict(cv_model, newx=test1)
> >> >>
> >> >>
> >> >> ypred=predict(predictLasso,newdata=test1)
> >> >> y=T[-sam,]$y
> >> >>
> >> >> MSE = mean((y-ypred)^2)
> >> >...