Stochastic functional analysis with applications to robust machine learning