How to use Machine Learning for Testing and Implementing Optical Networks