added unsupervised model support; changed preamble to be a function and updated the example accordingly