Quantum error correction (QEC) is an expensive proposition for quantum resources. Furthermore, most QEC codes are rigid in that they assume a particular type of error and do not build a solution that is tailored for the physical machine that it is run on. In this paper, we devise a machine learning inspired quantum algorithm that generates an approximate QEC code for a quantum computer, requiring only minimal quantum resources.