Optimization techniques for large scale finite sum problems