I need help to create a for loop function testing a range of lambda values from 0 to 1 in steps of 0.1 in a prediction model then plotting the output in a scatter plot against the MSE
here is the code i have so far
# Now we run the model with lamda values ranging from 0 to 1 in steps of 0.1 to see how the MSE is affected.
MSEV=vector(length=3)
j=0
for (l in c(0:1, step=0.1)){
j=j+0.1
lamda=l
y_measured=y+rnorm(n,0,lamda/(1+abs(x)))
v=200
xval=runif(n,-4*pi,4*pi)
yval=ifelse(xval==0,1,sin(xval)/xval)+rnorm(v,0,lamda/(1+abs(xval)))
xvdf=as.data.frame(xval)
net.resultsv=compute(ANNtrainingmodel,xvdf)
predictiontablev=cbind(xvdf,yval,as.data.frame(net.resultsv$net.result))
colnames(predictiontablev)=c("input","expected output","neural net output")
MSEV[j]==mean(abs(predictiontablev$"neural net output"-predictiontablev$"expected output"))
}
validate_mean=MSEV[which.min(MSEV)]
lamdavalue <- c(0:1,step=0.1)
plot(validate_mean, lamdavalue)