Machine learning to extract gravitational wave transients