Advanced pulse shape discrimination via machine learning for applications in thermonuclear fusion