Stochastic alternating optimization methods for solving large-scale machine learning problems