The plasma density is an important factor in determining wave-particle interaction in the magnetosphere. We develop a machine learning-based electron density (MLED) model in the inner magnetosphere using a data set of electron density from Van Allen Probes between September 25, 2012 and August 30, 2019. This MLED model is a physics-based nonlinear network that employs fundamental physical principles to represent the variation of electron density. It predicts the plasmapause location under different geomagnetic activities and models the electron density of the plasmasphere and trough separately. We train the model using gradient descent and backpropagation algorithms, which can be widely used to deal effectively with nonlinear relationships among physical quantities in space plasma environments. The model gives explicit expressions with few parameters and describes the association of electron density with geomagnetic activity, solar cycle, and seasonal effects. Under various geomagnetic conditions, the electron densities calculated by this model agree well with the observation and provide a good description of the plasmapause
movement. This MLED model, which can be easily incorporated into the previously developed radiation belt model, would be very helpful in modeling and forecasting the radiation belt electron dynamics.