Shape memory materials have been playing an important role in a wide range of bioengineering applications. At the same time, recent developments of graphene-based nanostructures, such as nanoribbons, have demonstrated that, due to the unique properties of graphene, they can manifest superior electronic, thermal, mechanical, and optical characteristics ideally suited for their potential usage for the next generation of diagnostic devices, drug delivery systems, and other biomedical applications. One of the most intriguing parts of these new developments lies in the fact that certain types of such graphene nanoribbons can exhibit shape memory effects. In this paper, we apply machine learning tools to build an interatomic potential from DFT calculations for highly ordered graphene oxide nanoribbons, a material that had demonstrated shape memory effects with a recovery strain up to 14.5% for 2D layers. The graphene oxide layer can shrink to a metastable phase with lower constant lattice through the application of an electric field, and returns to the initial phase through an external mechanical force. The deformation leads to an electronic rearrangement and induces magnetization around the oxygen atoms. DFT calculations show no magnetization for sufficiently narrow nanoribbons, while the machine learning model can predict the suppression of the metastable phase for the same narrower nanoribbons. We can improve the prediction accuracy by analyzing only the evolution of the metastable phase, where no magnetization is found according to DFT calculations. The model developed here allows also us to study the evolution of the phases for wider nanoribbons, that would be computationally inaccessible through a pure DFT approach. Moreover, we extend our analysis to realistic systems that include vacancies and boron or nitrogen impurities at the oxygen atomic positions. Finally, we provide a brief overview of the current and potential applications of the materials exhibiting shape memory effects in bioengineering and biomedical fields, focusing on data-driven approaches with machine learning interatomic potentials.