Personalized medicine has received increasing attention among statisticians, computer scientists and clinical practitioners. Patients often show significant heterogeneity in response to treatments. The estimation of optimal treatment regimes is of considerable interest to personalized medicine. In this dissertation, we develop methodology mainly using machine learning techniques to estimate optimal treatment regimes. In the first part of the dissertation, we apply the k-nearest neighbor (kNN) rule, a simple nonparametric approach, to estimate the optimal treatment regime. We show that the kNN rule is universally consistent, and establish its convergence rate. Since kNN suffers from the curse of dimensionality, we develop an adaptive k-nearest neighbor (AkNN) rule, where the distance metric is adaptively determined from the data, to perform metric selection and variable selection simultaneously. The performance of the proposed methods is illustrated in simulation studies and in an analysis of the Nefazodone-CBASP clinical trial. In the second part, we point out several weaknesses in outcome weighted learning (OWL), which was proposed recently to construct optimal treatment regimes by directly optimizing the clinical outcome. We then propose a general framework, called residual weighted learning (RWL), to alleviate these problems. RWL weights misclassification errors by residuals of the outcome from a regression fit on clinical covariates excluding treatment assignment. We also propose variable selection methods for linear and nonlinear rules, respectively, to further improve performance. We show that the resulting estimator is consistent, and obtain a rate of convergence. The performance is illustrated in simulation studies and in an analysis of cystic fibrosis clinical trial data. In the third part, we develop a permutation test for qualitative treatment-covariates interactions. Qualitative interactions arise when the direction of the treatment effect changes among different subsets of subjects. In this work, we estimate the optimal treatment regime by a modified residual weighted learning method, called mirrored residual weighted learning (MRWL), and then apply a permutation test to make inference on the estimated regime. The performance of the proposed permutation test is illustrated in simulation studies and case studies.