This chapter presents a study on L1 optimization for the problem of electricity demand prediction based on machine learning. This electricity demand prediction is very important for balancing the power supply and demand in smart power grids, a critical infrastructure in smart societies, where the energy consumption increases every year. Due to its robustness to outliers, L1 optimization is suitable to deal with challenges posed by the uncertainties on weather forecast, consumer behaviors, and renewable generation. Therefore, L1 optimization will be utilized in this research for machine learning techniques, which are based on artificial neural networks (ANNs), to cope with the nonlinearity and uncertainty of demand curves. In addition, two approaches, namely L2 and alternating direction method of multiplier (ADMM), will be used to solve the L1 optimization problem and their performances will be compared to find out which one is better. Test cases for realistic weather and electricity consumption data in Tokyo will be introduced to demonstrate the efficiency of the employed optimization approaches.