Liquid crystal on silicon phase-only spatial light modulators are widely used for the generation of multi-spot patterns. The phase distribution in the modulator plane, corresponding to the target multi-spot intensity distribution in the focal plane, is calculated by means of the so-called phase retrieval algorithms. Due to deviations of the real optical setup from the ideal model, these algorithms often do not achieve the desired power distribution accuracy within the multi-spot patterns. In this study, we present a novel method for generating high quality multi-spot patterns even in the presence of optical system disturbances. The standard Iterative Fourier Transform Algorithm is extended by means of machine learning methods combined with an open camera feedback loop. The machine learning algorithm is used to predict the mapping function between the desired and the measured multi-spot beam profiles. The problem of generation of multispot patterns is divided into three complexity levels. Due to distinct parameter structures, each of the complexity levels requires differing solution approaches, particularly differing machine learning algorithms. ... mehrThis relation is discussed in detail eventually providing a solution for the simplest case of beam splitter pattern generation. Solutions for more complex problems are also suggested. The approach is validated, whereby one machine learning method is successfully implemented and tested experimentally.