Real time location systems (RTLSs) are becoming more relevant in a more data driven economy and society due to their wide range of application cases. When the location of an object needs to be tracked with high accuracy, ultra wideband (UWB) technology is usually the best option. Nevertheless, UWB ranging estimates are not completely immune to some sources of error such as non line of sight (NLOS) or multipath conditions. Thus, this paper proposes a real-time classification model based on machine learning (ML) to predict if received ranging estimates are in line of sight (LOS) or NLOS conditions and discard those in NLOS. However, it is also shown that classifying measurements as LOS or NLOS does not guarantee detecting inaccurate ranging estimates, since LOS measurements can also yield large errors. As an example, the ranging root mean square error (RMSE) of the data labelled as LOS in a UWB based localization system database in the literature is of 0,714 m, significantly higher than the theoretical accuracy of a UWB system. Thus, a novel ML-based classification model is proposed to predict the magnitude of the ranging error. After applying the proposed classification model in the same data, the ranging RMSE of those ranging samples classified as most accurate is of only 0.183 m, significantly lower than the best RMSE we can obtain on the classical LOS/NLOS classification approach.INDEX TERMS DWM1000, machine learning, random forest, ranging errors, real time location system, ultra wideband.