Deep learning for anomaly detection and representation learning