Large numbers of machine learning algorithms heavily rely on a similarity or distance metric to measure the semantic relations of input data. Automatically defining a good metric is the subject of distance metric learning . In this thesis we investigate two new approachs for semisupervised and unsupervised metric learning. In most of semi-supervised algorithms, the similar set S and dissimilar set D are given and algorithms try to satisfy the following constraints: The members of set S should be close together and at the same time members of dissimilar set D should be far apart. In this paper, without using the similar set S and only by using the dissimilar set D , we try to divide data into small number of pure groups. Our convex optimization formula guarantees to find the global optima and the experimental results show that our algorithm has significant improvement over the existing algorithms. in the other side in unsupervised metric learning algorithm Due to the lack of label information in these category the work is harder. the second new algorithm in this thesis i an unsupervised metric learning algorithm that in contrast of other approaches that work based on dimensionality reduction such that some geometric or statistical properties are achieved during the optimization., our method works based on the large separability between different class data where we use fuzzy c-means to make up the lack of label information. Through our method, we are able to handle both numerical and categorical data which is one of the open issues in distance metric learning. The experimental results show that our algorithm has significant improvement over the existing algorithms. Keywords: machine learning ; distance metric learning;