There are several machine learning techniques to detect cancer being used; also several dietary steps are said to be very effective against this dreaded disease.
This is a very interesting topic. But your question is a very general question. I was working with breast cancer a year ago and I used Iterative Dichotomiser 3 (ID3) algorithm to diagnosis whether the cell is a cancerous cell or not. There are several methods depending on which kind of cancer you want to know.
About the dietary steps in order to against this disease, I am not quite sure.
I hope you find useful in my answer. Feel free to contact me more about this topic if you have any question.