  Blazars optical emission is generally dominated by relativistic jets,
although the host galaxy, accretion disk and broad line region (BLR) may also
contribute significantly. Disentangling their contributions has been
challenging for years due to the dominance of the jet. To quantify the
contributions to the spectral variability, we use the statistical technique for
dimensionality reduction Non-Negative Matrix Factorization on a spectroscopic
data set of 26 $\gamma$-ray blazars. This technique allows to model large
numbers of spectra in terms of a reduced number of components.We use a priori
knowledge to obtain components associated to meaningful physical processes. The
sources are classified according to their optical spectrum as host-galaxy
dominated BL Lac objects (BL Lacs), BL Lacs, or Flat Spectrum Radio Quasars
(FSRQs). Host-galaxy sources show less variability, as expected, and
bluer-when-brighter trends, as the other BL Lacs. For FSRQs, more complicated
colour-flux behaviours are observed: redder-when-brighter for low states
saturating above a certain level and, in some cases, turning to
bluer-when-brighter. We are able to reproduce the variability observed during
10 years using only 2 to 4 components, depending on the type. The simplest
scenario corresponds to host-galaxy blazars, whose spectra are reconstructed
using the stellar population and a power law for the jet. BL Lac spectra are
reproduced using from 2 to 4 power laws. Different components can be associated
to acceleration/cooling processes taking place in the jet. The reconstruction
of FSRQs also incorporates a QSO-like component to account for the BLR, plus a
very steep power law, associated to the accretion disk.
