  We present a method that accurately propagates residual uncertainties in
photometric redshift distributions into the cosmological inference from weak
lensing measurements. The redshift distributions of tomographic redshift bins
are parameterised using a flexible modified Gaussian mixture model. We fit this
model to pre-calibrated redshift distributions and implement an analytic
marginalisation over the potentially several hundred redshift nuisance
parameters in the weak lensing likelihood, which is demonstrated to accurately
recover the cosmological posterior. By iteratively fitting cosmological and
nuisance parameters arising from the redshift distribution model, we perform a
self-calibration of the redshift distributions via the tomographic cosmic shear
measurements. Our method is applied to the third data release of the
Kilo-Degree Survey combined with the VISTA Kilo-Degree Infrared Galaxy Survey
(KV450). We find constraints on cosmological parameters that are in very good
agreement with the fiducial KV450 cosmic shear analysis and investigate the
effects of the more flexible model on the self-calibrated redshift
distributions. We observe posterior shifts of the medians of the five
tomographic redshift distributions of up to $\Delta z \approx 0.02$, which are
however degenerate with an observed decrease of the amplitude of intrinsic
galaxy alignments by about $10\%$.
