Improving the Stability of the Recovery of Algebraic Curves via Bernstein Basis Polynomials and Neural Networks