Sentiment analysis is part of contextual text mining, which detects, extracts and supports an organization in understanding their brand or service in social sentiment while monitoring the reviews provided by customers in online shops. The rise of online shopping and digitalization is practically achieved, and the quality of products is tough for users to judge. There is no model to find out about the same or unlike a set of people with similar sentiment analysis concerning online product evaluations. In this paper optimization-based classification algorithm is proposed namely, Affirmative Ant Colony Optimization Based Support Vector Machine (AACOSVM) to classify sentiments provided by customers in online shopping. This paper provides a new Ant Colony Optimization method via providing a novel pheromone model for support vector machine optimization parameters in two steps. The first one is statute of state transition, and the second step is statute of state updates. They aim to allow the ants to use the fake pheromone path to pick parameters and to motivate ants to create subsets having the least classification mistakes. The proposed work includes product review datasets from Amazon to assess the performance of the AACOSVM against existing classifiers, namely, Entropy-Based Classifier (EBC) and Enhanced Feature Attention Network (EFAN). Various review datasets are accessible at Amazon for various items. This research effort has identified a dataset from DVDs, books, kitchen appliances and electronics from the many multiple available review datasets. It utilizes the natural foraging behavior of ants towards searching for food to identify and classify the sentiments present in the product reviews. AACOSVM is evaluated using two standard data mining performance metrics, namely F-Measure and Classification Accuracy. Results indicate that the proposed classification algorithm AACOSVM achieves better F-Measure and Classification Accuracy than the EBC and EFAN classifiers.