Machine learning approach to inverse problem and unfolding procedure