We develop the learning algorithm to build the architecture agnostic model of the reconfigurable optical interferometer. Programming the unitary transformation on the optical modes of the interferometer either follows the analytical expression yielding the unitary matrix given the set of phaseshifts or requires the optimization routine if the analytic decomposition does not exist. Our algorithm adopts the supervised learning strategy which matches the model of the interferometer to the training set populated by the samples produced by the device under study. The simple optimization routine uses the trained model to output the phaseshifts of the interferometer with the given architecture corresponding to the desired unitary transformation. Our result provides the recipe for efficient tuning of the interferometers even without rigorous analytical description which opens opportunity to explore new architectures of the interferometric circuits.