We introduce low complexity machine learning method method (based on lasso regression, which promotes sparsity, to identify the interaction between symbols in different time slots and to select the minimum number relevant perturbation terms that are employed) for nonlinearity mitigation. The immense intricacy of the problem calls for the development of "smart" methodology, simplifying the analysis without losing the key features that are important for recovery of transmitted data. The proposed sparse identification method for optical systems (SINO) allows to determine the minimal (optimal) number of degrees of freedom required for adaptive mitigation of detrimental nonlinear effects. We demonstrate successful application of the SINO method both for standard fiber communication links (over 3 dB gain) and for few-mode spatial-division-multiplexing systems.