Identification of users' polarities and mining their opinions in various areas, especially social networks, has become one of the popular and useful research fields. Although opinion mining and analyzing methods based on machine learning or lexicon have been useful, high training cost based on time or memory used, lack of enriched and complete lexicons, high dimensions of feature space and ambiguity in positive or negative detection of some sentences in these methods are examples of their downsides. To cope with these problems, in this paper a helpful method based on lexicon and machine learning called OMLML is proposed by using social networks. The main superiority of the proposed method compared to other methods is addressing these challenges simultaneously. According to the proposed method, the polarity of the opinions toward a target word is first determined using a method based on lexicon and textual features of words and sentences. Next, having mapped feature space into a 3-D vector, opinions are analyzed and classified based on a new machine learning method. The results of quantitative and qualitative experiments show that mapping data into a new space decreases training cost and that the performance of the proposed method than is acceptable particularly from the perspective of accuracy, F-measure and runtime.