Automated classification of transients in optical time-domain surveys