Isnt this what auto encoders are for?