How to predict correctly after cross validation I'm trying to understand the steps I have to do to predict well. I will try to write an example. 


*

*I have a dataset X with e.g. 10 predictors and y the response.

*I divide the data into test and training set and do cross validation.

*I find the best $\lambda$ value using lasso and I find the coefficients that correspond to this $\lambda$ value. Now these coefficients determine which predictors will stay in my model, e.g. $x_1,x_2,x_3$ and all the others are zero. 


To predict do I have to use these coefficients, to get the prediction for the output? 
$y=\beta_0 + \beta_1 x_1 +\beta_2 x_2 +\beta_2 x_2$
And do I have to use a new dataset that corresponds with the nature of the initial dataset, which I used to find the coefficients. 
Here I have a shaky understanding, I'm not sure if this is correct. 
 A: As you correctly noted, cross-validation entails dividing your data into subsets. In the simplest case, this will just be a test and a train set.
What you describe in step 3 can generally described as fitting your model to the data in the training set. In the case of a lasso regression the trained model provides us with the coefficients as you correctly stated. 
To evaluate this model, we apply it to the test set, which the model hasn't 'seen' during fitting. This way we can get an idea of how well the model generalizes on new data.
For each instance in the test set we can compute the models predicted output as you correctly stated above.
For an instance $x$ consisting of $m$ attributes in our test set we compute the models output $$\hat{y} = \beta_0 + \beta_1 x_1 + ... +\beta_m x_m =f(x,\beta)$$.
How well did the model do though?
 To evaluate this, we simply compare how far the predicted value $\hat{y}$ deviates from the true value $y$ for a given test instance $x$. There are different measures that can be used for this, like root-mean-square error (RMSE), mean absolute error (MAE) and many more.
Now we have a numerical measure of the quality of the model regarding the test set. This can give an impression of how well the model did and can be used for comparing different models.
Here's an answer regarding the interpretation of cross-validation results.
