  Stochastic differential equations can describe a wide range of dynamical
systems, and obtaining the governing equations of these systems is the premise
of studying the nonlinear dynamic behavior of the system. Neural networks are
currently the most popular approach in the inverse problem of dynamical
systems. In order to obtain accurate dynamical equations, neural networks need
a large amount of trajectory data as a training set. To address this
shortcoming, we propose a residual-based multi-peaks sampling algorithm.
Evaluate the training results of each epoch of neural network, calculate the
probability density function $P(x)$ of the residual, perform sampling where the
$P(x)$ is large, and add samples to the training set to retrain the neural
network. In order to prevent the neural network from falling into the trap of
overfitting, we discretize the sampling points. We conduct case studies using
two classical nonlinear dynamical systems and perform bifurcation and first
escape probability analyzes of the fitted equations. Results show that our
proposed sampling strategy requires only 20$\sim $30\% of the sample points of
the original method to reconstruct the stochastic dynamical behavior of the
system. Finally, the algorithm is tested by adding interference noise to the
data, and the results show that the sampling strategy has better numerical
robustness and stability.
