Adaptive Stochastic Resource Control: A Machine Learning Approach