How is cross validation different from data snooping? I just finished "An Introduction to Statistical Learning". I wondered whether using cross-validation to find the best tuning parameters for various machine learning techniques is different from data snooping? 
We are repeatedly checking which value of the tuning parameter results in a best predictive result in the test set. What if the tuning parameter we arrive at just happens to fit this particular test set by chance, and won't perform well on some future test set?
Please excuse my novice understanding of machine learning, and I'm eager to be educated.
EDIT: Please see @AdamO answer on the definition of "data snooping". I used the term very inaccurately in my question.
 A: Cross validation is used to assess the validity of a particular finding, usually tangibly related to a prediction model. These kinds of findings can include results from cluster analyses, classification, or prediction models. In any case, the nature of the analysis is part of a pre-specified question of scientific interest such as "which frequencies of mRNA expression most likely originated from breast cancer biopsies versus healthy controls?". Cross validation is a very robust way to assess the validity of a prespecified prediction model that serves a specific purpose. I suspect that $k$-fold cross validation, which involves repeated model fitting, may be the origin of your confusion.
When using CV to identify an "optimal" tuning parameter, as is needed with penalized likelihood methods, there is usually a prespecified criterion that the process is set to meet. This might be minimal MSE, or maximal AUC, or minimal BIC. If you cherry pick a $\lambda$ which gives you results you are after, then you have done something worse than data dredging, I think. So, using a microarray example, if you are interested in which proteins are more expressed in cancer cases versus controls, you might prespecify a GLM LASSO to have $\lambda$ give the best BIC and markers selected in the final model are chosen as candidate proteins for further investigation. This is an example of feature selection.
"Data snooping" or, as I could call it, "Exploratory data analysis" does not deal with a pre-specified question. You kind of enumerate a number of possible, plausibly interesting results and evaluate them individually. You can perform any number of exploratory analyses and, usually, you don't worry about multiple testing. You can assess each exploratory analysis individually using cross-validation, but it does not inherently account for multiple testing when you have more than 1 exploratory analysis. Hypotheses in this setting can be quite wide and far reaching, "which factors are associated with prostate cancer?" (from which coffee drinking, vasectomy usage, etc. etc. were measured in a cohort). Significant results are seen as "hypothesis generating" and provide no confirmatory evidence.
So while both approaches are somewhat "iterative" in nature, they are entirely independent procedures. $k$-fold cross-validation is a tool for assessing uncertainty and validity of a particular set of findings which are part of a "modular" hypothesis. Data dredging, data snooping, or exploratory data analysis is meant to generate hypotheses based on a large set of possibly interesting questions addressed by a comprehensive and large dataset.
A: 
I wondered whether using cross-validation to find the best tuning parameters for various machine learning techniques is different from data snooping? 

Your concern is right spot on, and there is a whole lot of literature on this topic, e.g.


*

* Cawley, G. C. & Talbot, N. L. C.: On Over-fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation, Journal of Machine Learning Research, 11, 2079-2107 (2010).  

* Boulesteix, A.-L.: Over-optimism in bioinformatics research., Bioinformatics, 26, 437-439 (2010). DOI: 10.1093/bioinformatics/btp648 

* Jelizarow, M.; Guillemot, V.; Tenenhaus, A.; Strimmer, K. & Boulesteix, A.-L.: Over-optimism in bioinformatics: an illustration., Bioinformatics, 26, 1990-1998 (2010). DOI: 10.1093/bioinformatics/btq323
The problem is that hyperparameter tuning with cross validation is a data-driven optimization process, and will still tend to overfit to yor data set (less than tuning by resubstitution error, but still). Trying to use the tuning cross validation results as "independent" performance measure is in a way like eating the pie (= tuning) and keeping (= measure final model performance) it. 
This does not mean that you shouldn't use cross-validation for hyperparameter tuning. It just means that you can use it only for one purpose. Either optimize or measure model performance for validation purposes. 
The solution is that you need to do an independent validation for measuring the quality of the model obtained with the tuned hyperparameters. This is called nested or double validation. You'll find a number of questions and answers here on these topics


*

* Filzmoser, P.; Liebmann, B. & Varmuza, K.: Repeated double cross validation, J Chemom, 23, 160-171 (2009). DOI: 10.1002/cem.1225 

*Brereton, R.: Chemometrics for pattern recognition, Wiley, (2009).


Conceptually, I like to say that training includes all kinds of fancy steps to fit not only the "usual" model parameters but also to fit (auto-tune) the hyperparameters. So data-driven optimization of λ is clearly part of the model training. 
As a rule of thumb you can also say that model training is everything that needs to be done before you have a ready-to-use final black-box function that is able to produce predictions for new cases. 

PS: I find the testing vs. validation terminology very confusing because in my field "validation" means proving that the final model is fit for purpose, and is therefore what other people call testing rather than validation. I prefer to call the inner test set "tuning test set" and the outer "final validation test set" or the like. 

Update: 

So if my model (i.e. my tuning parameter in this case) fails the outer validation, what should I do then? 

Typically, this is nothing that just happens: there are typical situations that can cause such a failure. And all such situations that I'm aware of are overfitting situations. You need to be aware that while regularization helps to reduce the necessary number of training cases, data-driven optimization needs large amounts of data. 
My recommendations: 


*

*Typically, you (should) already have rough expectations, e.g. what performance should be achievable, what performance you'd consider suspiciously good looking. Or have specs what performance you need to achieve and a baseline performance. From that and the number of availabe training cases (for the splitting scheme you decided for), calculate the expected uncertainty for the inner (tuning) tests. If that uncertainty indicates that you would not be able to get meaningful comparisons, don't do data-driven optimization. 

*You should check how stable both the obtained predictions with the chosen λ and the optimal λ found by the auto-tuning procedure are. If λ isn't reasonably stable with respect to different splits of your data, the optimization didn't work.

*If you find that either you won't be able to do the data-driven optimization or that it didn't work after all, you may choose the λ by your expert knowledge, e.g. from experience with similar data. Or by the knowledge that if you find out that the optimization failed, you'll need a stronger regularization: the overfitting that leads to the failure works towards too complex models. 
A: Actually, during CV you try to find the best parameters on a validation set, which is distinct from the test set. You split your entire data into three sets : training set, validation set, and test set. When you do cross-validation properly, you never look at the test end until the end, so there is no snooping at all. Doing cross-validation on the test set is a serious (yet frequent) methodological error.
A: If you look for example at page 225 of  "An Introduction to Statistical Learning" with Lasso example, you see that they actually do nested cross-validation. I.e. the model selection is done in cv.glmnet on a train set, which is split by the cv.glmnet package into train-test pairs. The model validation is done on validation ("test") set, so it is independent validation.
