Asking a High School Teacher for a Letter of Recommendation
Don't ask the high school teacher unless that's the only way you can get an enthusiastic letter.  First, asking someone from high school looks like an admission of weakness or decline, like you haven't impressed anyone in college as much as you did in high school, and that's not a good message to send.  Second, a high school teacher will have less perspective on how you compare with undergraduate and graduate students, which is the primary issue.  Finally, it's really hard to judge graduate school potential on the basis of high school performance.  For example, the math team experience you mention can be misleading.  Contest problems differ systematically from research in that they are guaranteed to have short, elegant solutions and they have strict limitations on what sort of background might be required.  These constraints are often comforting to students, and I've known people who loved math contests and were great at them but didn't enjoy or weren't particularly successful at research.

I'd recommend talking with your machine learning professor to see whether he thinks he's in a position to write a compelling letter.  If so, then go with that.  If he is reluctant, then you should choose someone else.  That could include the high school teacher if necessary (better a recommendation from a high school teacher than from someone unsupportive), or other options you haven't mentioned.