Defined the deep belief training function.