Machine Learning Modelling, Optimisation And Thermal Compensation of Photonic Waveguides