Magnetic shielding plays an important role in magnetically susceptible devices such as cold atom clocks, atomic interferometers and other precision equipment. The residual magnetic field in a magnetic shield under a varying external magnetic field can be calculated by the Jiles-Atherton (J-A) hysteresis model and magnetic shielding coefficient. According to the calculation results, the variation of internal magnetic field can be compensated for the active compensation coils. However, it is difficult to practically obtain the exact values of the five magnetic-shielding-related parameters in the J-A hysteresis model and the other two magnetic-field-attenuation-related parameters. It usually takes a lot of time to match the parameters manually according to the measured hysteresis loop and it is difficult to ensure that the final parameters are the global optimal values. The machine learning method based on artificial neural network has been used as an efficient method to optimize the parameters of complex systems. Owing to the powerful computing capability of modern computers, using the artificial neural network to optimize parameters is usually much faster than manual optimization method, and has a greater probability of finding the global optimal parameters. In this paper, the five J-A parameters and the other two parameters relating to magnetic field attenuation are optimized by the method of online learning based on artificial neural network, and the residual magnetic field in the magnetic shield is predicted under the simulated satellite magnetic field environment. By comparing the measured residual magnetic field with the predicted value, it is found that the machine learning method can optimize the magnetic shielding characteristic parameters more quickly and accurately than the manual optimization method. This result can not only help us to compensate for the magnetic field better and optimize the parameters of our cold atom system, but also validate the application of neural network in a multi-parameter physical system. This proves that the in-depth learning neural network can be conveniently applied to other physical experiments with multi-parameter interaction, and can quickly determine the optimal parameters needed in the experiment. This application is especially effective for remote experiments with slow response to parameter adjustment, such as scientific experiments carried out on satellites or deep space.