Severe space weather produced by disturbed conditions on the Sun results in harmful effects both for humans in space and in high-latitude commercial flights, and for technological systems such as spacecraft or communications. Also, geomagnetically induced currents flowing on long ground-based conductors, such as power networks or pipelines, potentially threaten critical infrastructures on Earth. The first step in developing an alarm system against geomagnetically induced currents is to forecast them. This is a challenging task, though, given the highly non-linear dependencies of the response of the magnetosphere to these perturbations. In the last few years, modern machine-learning models have shown to be very good at predicting magnetic activity indices as the SYM-H. However, such complex models are on the one hand difficult to tune, and on the other hand they are known to bring along potentially large prediction uncertainties which are generally difficult to estimate. In this work we aim at predicting the SYM-H index characterising geomagnetic storms one hour in advance, using public interplanetary magnetic field data from the Sun--Earth L1 Lagrange point and SYM-H. We implement a type of machine-learning model called long short-term memory networks. Our scope is to estimate -for the first time to our knowledge- the prediction uncertainties coming from a deep-learning model in the context of space weather. The resulting uncertainties turn out to be sizeable at the critical stages of the geomagnetic storms. Our methodology includes as well an efficient optimisation of important hyper-parameters of the long short-term memory network and robustness tests.