One of the main problems facing accurate location in wireless communication systems is non-line-of-sight (NLOS) propagation. Though location methods based on learning theory perform well in NLOS environments, these methods may be further improved since they do not consider outliers in the training data set. In this letter, we extend least squares support vector machine (LS-SVM) algorithm to general cost functions, and use this algorithm to solve mobile location problem. The proposed method can effectively suppress outliers with weight function. Specially, LS-SVM algorithm can be interpreted as special case of our algorithm. Simulation results show that the location accuracy is significantly improved over traditional algorithms.