A ??-margin kernel learning machine(??-MKLM) with magnetic field effect is proposed for pattern classification problem in this paper. The basic idea is to find a optimal superplane with magnetic field effect such that the distance between one class and the hyperplane is as small as possible due to the magnetic attractive effect, while at the same time the margin between the hyperplane and the other classes is as large as possible due to magnetic repulsion, thus implementing pattern classification as much as possible. Moreover, a magnetic field density ?? is introduecd to compact the data distribution of one class, thus improving the classification performance of ??-MKLM even more. Exprimental results obtained with synthetic and real data show that the proposed algorithms are effective and competitive to other related diagrams in such cases as two-class and one-class pattern classification respectively.