Ultra-wideband (UWB) has been growing exponentially and received a lot of attention around the world to address the need for high precision Indoor Positioning Systems (IPS) in challenging the emergence of the Internet of Things (IoT) use cases. However, the positioning error caused by the Non-Line-of-Sight (NLoS) signal propagation affects cooperative positioning accuracy noticeably, therefore, NLoS signals detection is important for the high precision IPS. This thesis reports the results of the research work conducted to invent Machine Learning (ML)-based NLoS detection algorithms to improve the positioning accuracy in such NLoS conditions, and empirically validate their performance. One of the major contributions of this thesis is the development of unsupervised ML algorithms based on Gaussian Distribution (GD) and Generalized Gaussian Distribution (GDD) to classify the Line-of-Sight (LoS) and NLoS signals for an imbalanced dataset. By employing our detection algorithm for the imbalanced dataset, the NLoS classification accuracy can achieve 96.7 % for GD and 98.0% for GGD which demonstrated a higher detection accuracy compare with the existing cutting-edge ML algorithms such as Support-Vector-Machine (SVM), Decision Tree (DT), Naive Bayes (NB) and Neural Network (NN) (an accuracy reach of 92.6%, 92.8%, 93.2% and 95.5% respectively. The proposed algorithms are developed using Matlab (2020b) software. The second contribution is the development of Fine-Tuned attribute Weighted Naïve Bayes (FT-WNB) classifier to enhance the NLoS classification accuracy by assigning each UWB signal feature a specific weight and fine-tune the classification accuracy by addressing the mismatch between the predicted and actual class. The performance of the FT-WNB classifier is compared k-Nearest Neighbour (KNN), SVM, DT, NB, and NN. It is demonstrated that the proposed classifier outperforms other algorithms by achieving a NLoS classification accuracy of 99.7% in the best case which significantly enhance the classification accuracy in considered scenario. Finally, a Transfer Learning (TL) framework for UWB NLoS detection and error correction towards multiple environments and different UWB device configurations is investigated. This technique can enhance the ML algorithms of NLoS detection and error correction in totally unseen environments, different UWB devices configurations and different device deployment. The impact of the number of selecting samples for TL is also described. By employing TL-based algorithm for the different environments, the highest absolute NLoS classification accuracy is typically achieved 89.7% and the best performance of error correction achieved 141.6 mm (original is 306 mm), where with as few as 50 samples from the new mixed LoS-NLoS environment. This is developed using Python 3.10 (Tensorflow) software.