Revealing the nature of hidden charm pentaquarks with machine learning