The electronic charge density plays a central role in determining the
behavior of matter at the atomic scale, but its computational evaluation
requires demanding electronic-structure calculations. We introduce an
atom-centered, symmetry-adapted framework to machine-learn the valence charge
density based on a small number of reference calculations. The model is highly
transferable, meaning it can be trained on electronic-structure data of small
molecules and used to predict the charge density of larger compounds with low,
linear-scaling cost. Applications are shown for various hydrocarbon molecules
of increasing complexity and flexibility, and demonstrate the accuracy of the
model when predicting the density on octane and octatetraene after training
exclusively on butane and butadiene. This transferable, data-driven model can
be used to interpret experiments, initialize electronic structure calculations,
and compute electrostatic interactions in molecules and condensed-phase
systems