[2501.08317] A Similarity Measure Between Functions with Applications to Statistical Learning and Optimization