  The rate of image acquisition in modern synoptic imaging surveys has already
begun to outpace the feasibility of keeping astronomers in the real-time
discovery and classification loop. Here we present the inner workings of a
framework, based on machine-learning algorithms, that captures expert training
and ground-truth knowledge about the variable and transient sky to automate 1)
the process of discovery on image differences and, 2) the generation of
preliminary science-type classifications of discovered sources. Since follow-up
resources for extracting novel science from fast-changing transients are
precious, self-calibrating classification probabilities must be couched in
terms of efficiencies for discovery and purity of the samples generated. We
estimate the purity and efficiency in identifying real sources with a two-epoch
image-difference discovery algorithm for the Palomar Transient Factory (PTF)
survey. Once given a source discovery, using machine-learned classification
trained on PTF data, we distinguish between transients and variable stars with
a 3.8% overall error rate (with 1.7% errors for imaging within the Sloan
Digital Sky Survey footprint). At >96% classification efficiency, the samples
achieve 90% purity. Initial classifications are shown to rely primarily on
context-based features, determined from the data itself and external archival
databases. In the ~one year since autonomous operations, this discovery and
classification framework has led to several significant science results, from
outbursting young stars to subluminous Type IIP supernovae to candidate tidal
disruption events. We discuss future directions of this approach, including the
possible roles of crowdsourcing and the scalability of machine learning to
future surveys such a the Large Synoptical Survey Telescope (LSST).
