Cognitive factors are associated with online purchase intentions in developing economies, and the linear models conventionally used to study them can miss non-linear patterns. We report an applied integration of the Theory of Planned Behavior (TPB) with machine learning and explainable AI (XAI) to predict social media-driven e-commerce purchase intentions in Bangladesh. Survey data from 352 young, student-dominated consumers captured attitudes, subjective norms, perceived behavioral control, and purchase behavior on validated Likert scale items. After reliability-based labeling and feature selection, we ran an ablation across seven classical classifiers and one multilayer perceptron, with stratified five-fold cross-validation, threshold sensitivity analysis, and a cross-domain check. With all TPB constructs included, support vector machines and AdaBoost reached 92% accuracy on the held-out test set, and cross-validated mean accuracy ranged from 0.84 to 0.88 for every model except the decision tree. These figures should be read against a positive-class prevalence of 82.1%, which inflates accuracy and F1 relative to imbalance-robust measures. Transfer to an independent North Indian sample was weak, with SVM MCC falling from 0.522 to 0.315 and AUROC from 0.923 to 0.775. In SHAP analyses, the four items the model relied on most were PBC1 (motivation from frequent advertising), SN3 (approval when many others buy through social media), ATTD4 (past purchase), and SN1 (family influence). Bivariate correlations and pathway-level regression with Benjamini–Hochberg correction are interpreted as associations, not causal effects, and Brier score and log loss are reported alongside SHAP and LIME to show whether predicted probabilities are calibrated. These findings are exploratory and specific to the sampled population; given the convenience sample, the class imbalance, and the weak transfer, they are not evidence of robust generalization or of readiness for deployment.
Citation: Barua S, Rahman R, Azad AKA, Momen S (2026) CogD-ML: Cognitive determinants of social commerce purchase intention in Bangladesh using machine learning and explainable AI. PLoS One 21(11): e0362973. https://doi.org/10.1371/journal.pone.0362973
Editor: Rongbin Yang, Kaplan Business School of Australia, AUSTRALIA
Received: December 23, 2025; Accepted: November 2, 2026; Published: November 20, 2026
Data Availability: The repository at https://github.com/GitsSaikat/cogd-ml now contains the survey data, one script per reported table, the prompts, model settings, hyperparameter grids, seeds and pinned software versions; the external dataset is available from Mendeley Data (doi:10.17632/b9hdy2swyy.1).
Funding: This work was supported by North South University through the CTRG grant CTRG-23-SEPS-08 awarded to AKAA (https://www.northsouth.edu). The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.
Competing interests: The authors have declared that no competing interests exist.
Consumer behavior in online shopping is shaped by cognitive and social factors, and attitudes toward buying online remain a documented barrier to adoption [1,2]. Using predictive models to forecast consumer purchase intentions based on such cognitive factors can inform management strategies and decision-making [1–3]. Analysis of online consumer purchase intention is especially important in developing nations, where social and economic advancement often depends on technological integration. These nations face distinct obstacles, since their populace may be less familiar with digital markets compared to those in industrialized countries, which calls for an analysis of the factors associated with behavioral intentions. The absence of consumer analysis, prevalent in the technology industry, underscores the need to engage users and meet their needs to foster a positive intention. The commercialization of digital markets relies on marketing strategies and developments that vary by region [4]. These conditions highlight the need for a comprehensive investigation to ensure that advancements correspond with users’ cognitive behavior, thereby promoting intention.
The Theory of Planned Behavior (TPB) is a widely used cognitive framework that explains how individual behaviors, such as purchasing decisions, are shaped [5]. According to this theory, a person’s intention to engage in a behavior is the most immediate antecedent of their actions, and three key factors shape this intention: attitude, subjective norm, and perceived behavioral control. Building on TPB, prior work has linked trustworthiness to individuals’ attitudes toward online purchasing [1]. Other research has shown that a positive attitude is an important factor for Malaysian netizens when it comes to online purchasing [3]. South American studies have demonstrated that self-efficacy in online stores is a key factor in e-commerce purchases [2].
However, traditional SEM is constrained in its ability to find non-linear correlations, a restriction that machine learning (ML) approaches can relax. Consumer decision-making is often complex and non-linear, which highlights the capacity of multilayer perceptrons (MLPs) and related models to identify both linear and non-linear relationships [6,7]. A hybrid methodology in social commerce emphasizes the importance of incorporating non-linearity into the analysis of customer behavior [3]. Machine learning can also handle extensive datasets and reveal complex patterns that conventional structural equation modeling may miss. Prior work illustrates this by using machine learning ensembles to forecast cloud storage usage intentions in the Philippines, highlighting the efficacy of machine learning in analyzing extensive datasets [6]. Moreover, machine learning demonstrates its usefulness in exploratory studies where there is a lack of theoretical direction. Algorithms such as AdaBoost and multilayer perceptrons can capture complex, non-linear associations [3,6].
The aim of this research is to explore the interplay between established holistic cognitive constructs and machine learning and deep learning. The goal is to create an integrated framework for analyzing and predicting consumer purchasing intention in the e-commerce industry of Bangladesh, with a strong focus on explainability. With the increasing relevance of social media marketing in the eyes of customers, it is essential for firms to fully comprehend and adjust to consumer behavior. Shmueli argues that explanatory and predictive models answer different questions, and that prediction can expose relationships an explanatory model misses [8]; our framework reports both. These contextual insights may assist social media marketers in developing more targeted marketing plans, allocating resources more efficiently, and improving the consumer experience. A prediction of this kind is not a neutral artifact. A model that identifies which consumers are most responsive to social proof is, in application, a tool for applying social pressure more efficiently, and the explanations that make it auditable also make it actionable in ways that can narrow rather than widen the consumer’s choice [9]. We return to this in the Discussion.
In addition to overall accuracy, the framework incorporates sensitivity analysis of the purchase-behavior threshold, per-fold performance summaries, and separate calibration plots for Brier score and log loss to assess not only whether classifications are correct, but also whether predicted probabilities are well calibrated and stable across folds [10]. Accuracy alone can obscure overconfident or poorly calibrated models, whereas Brier score and log loss act as strictly proper scoring rules that penalize misaligned probabilities and overconfident errors, providing a more reliable basis for decision-making in high-stakes marketing and policy contexts [10]. The explainable AI component combines global SHAP analyses with local LIME-based explanations to enhance transparency at both aggregate and individual levels [11]. A single additional dataset is used to probe whether the fitted signals survive a change of population and instrument. This is a limited transferability check on one external sample, not an assessment of generalization.
The remaining sections of the paper are arranged in the following sequence. Related work and research gaps are presented after this introduction. Following that, the research methodology is discussed. The results section provides an in-depth analysis of the findings and explores them further. In the discussion section, the study’s significant results and constraints are emphasized, followed by a discussion of potential avenues for further research.
The literature on consumer purchase intention has evolved significantly, moving from linear statistical models to advanced machine learning and deep learning frameworks. To provide context for our study, this section is organized into six areas. We begin by reviewing foundational work on consumer purchase intention and the Theory of Planned Behavior. We then discuss the transition to machine learning for behavior prediction. Following this, we cover three further dimensions of our framework: the role of statistical analysis in validating cognitive constructs, explainable AI (XAI) for transparent decision-making, and cross-domain generalizability as a check on whether a model transfers. We also state where our study sits relative to recent consumer prediction work. By bridging these diverse fields, our work aims to address some limitations of isolated methodological approaches by combining multiple analytical perspectives on consumer behavior. Table 1 provides a comparative summary of key studies in this domain, highlighting their methodologies, sample characteristics, key findings, and the specific research gaps that our study aims to address.
General disposition (or character) is considered an unreliable indicator of one’s behavior in specific situations [18]. The aggregation of particular behaviors across several instances, circumstances, and types of activity appears to indicate improved accuracy in predicting outcomes [19]. Nevertheless, the concept of behavior aggregation fails to clarify the variations in behavior observed across different settings or accurately foresee individual actions. Instead, it demonstrates that overall attitudes and personality traits have a broad impact on action, as shown in large, aggregated samples. These characteristics have an indirect influence on certain acts through immediate causes.
Ajzen et al. explore the elements that influence behavior using the Theory of Planned Behavior (TPB) framework [5]. TPB was formulated with the purpose of forecasting and understanding human behavior under certain circumstances [20]. The TPB was an extension of the Theory of Reasoned Action, where the intention to perform the behavior was primarily determined by the intention to perform the behavior, which in turn was influenced by attitudes and subjective norms [21]. TPB expands on the Theory of Reasoned Action by including perceived behavioral control as an additional determinant of intentions and behavior. The theory suggests that an intent to engage in a certain activity is the fundamental factor that predicts whether the behavior will really occur. It is possible to predict a person’s intentions with accuracy by taking into account their attitudes (positive or negative feelings toward the behavior), subjective norm (perceived social pressure to engage in or abstain from the behavior), and perceived behavioral control (perceived ease or difficulty of performing the behavior) [5].
A deeper exploration of TPB reveals that attitudes can shape intentions through mental imagery [22]. When users engage with objects in virtual product experiences, it stimulates the creation of clear mental images. These images can directly influence the intention to make a purchase, even if the users’ cognitive sentiments towards the brand are not a factor. Other findings suggest that the perceived usefulness of bloggers’ suggestions and their degree of trust have a substantial impact on the attitude of blog users towards online shopping and their intention to make purchases [23]. Furthermore, results indicate that distinct factors influence the users of blogs with a perceived high reputation and those with a perceived poor reputation [23].
Similar to attitude, subjective norm has significant effects on people’s intentions, especially when it comes to reproduction [24], exercise and healthy eating [25], and prosocial conduct [26].
Perceived behavioral control acts as a moderator in the association between intentions and actual behavior in health-related situations [27]. Bloggers have a significant impact on customers’ purchase decisions by establishing the perceived utility and usefulness of their recommendations [23].
Almost all of these studies rely on Structural Equation Modeling (SEM) to test linear relations among the factors and hypotheses. However, this approach has significant shortcomings, as accuracy decreases when the core assumptions of linear regression are not met [28]. These assumptions include factors like linearity, normal distribution of errors, and independence of variables. If the data is complex, non-linear, or irregular, the model may struggle to produce accurate predictions or insights. Another major drawback is that these methods are heavily reliant on theories, where a weakness in a researcher’s model can impact the prediction as well. This issue has been discussed through the lens of factor composition, noting that a researcher’s factor composition may be significant through SEM analysis, yet they may be the wrong factors to answer the research questions [29].
Machine learning (ML) methods have demonstrated promising results in predicting customer purchasing patterns in both physical and e-commerce environments [14]. Following the noteworthy success of psychological frameworks, extensive research has been done on consumer behavior prediction such as churning [30,31], car buying intention [32], and green consumption practices [33]. ML can be combined with SEM to improve both the predictive accuracy and explanatory power of research models. One approach used was a hybrid SEM-AI approach [6,34,35]. In this approach, SEM is first used to test the hypotheses and establish a foundational understanding of the linear relationships within the conceptual model. The significant predictors identified through SEM are then used as input nodes for an MLP analysis, allowing the model to capture non-linear and non-compensatory associations that SEM might miss. Researchers have predicted technology acceptance by applying machine learning to the Technology Acceptance Model (TAM) [7]. Other work has focused on machine learning prediction and explainability, rather than SEM results [6,35]. It has been shown that using a combination of attitude, subjective norm, and perceived behavior control as factors, Gradient Boosting can predict purchase intention with 91% accuracy [3]. Recently, a similar concept was explored using the Unified Theory of Acceptance and Use of Technology, identifying relevant factors using SEM and machine learning [35].
While machine learning models predict well, they often lack the theoretical validation needed to check that the underlying cognitive constructs are being measured correctly. To address this, our framework places measurement validation before predictive modeling. Traditional statistical tools, such as Cronbach’s alpha for reliability and factor analysis for validity, provide evidence on whether the survey instruments used to capture cognitive constructs are internally consistent [36]. Reporting descriptive statistics and bivariate associations before fitting complex models also makes it possible to see which relationships a learner is exploiting [8]. Structural Equation Modeling (SEM) is frequently employed to estimate structured relationships in behavioral models, though with cross-sectional data these estimates remain associational [28]. Combining these validation steps with our ML pipeline lets us check that the classification target is a psychometrically coherent construct rather than a measurement artifact.
A critical barrier to the adoption of advanced machine learning in marketing is the “black box” nature of complex algorithms, which obscure the decision-making process. This lack of transparency makes it difficult for stakeholders to trust model outputs or derive actionable marketing strategies. Explainable AI (XAI) has emerged as a vital solution to this challenge. In consumer behavior research, “black box” models like deep neural networks often fail to provide actionable insights, limiting their adoption by marketers who need to understand why a prediction was made [12]. XAI techniques, such as SHAP (SHapley Additive exPlanations) and LIME (Local Interpretable Model-agnostic Explanations), address this by quantifying the contribution of each feature to the final output [11,37]. Recent work in PLOS ONE has paired interpretability methods with consumer prediction, using SHAP over text-derived features to explain perceived risk across 262,752 online reviews [12]. Salih et al. caution that SHAP and LIME outputs are model-dependent, sensitive to collinearity among features, and cannot be read as causal [37]; we interpret our own explanations under that constraint.
Consumer behavior prediction has advanced quickly in this journal, and it is worth stating plainly where our study sits relative to that work and where it does not compete. Lin applied SVM, XGBoost, CatBoost, and a backpropagation network to the Online Shoppers Purchasing Intention dataset, reporting F1 scores of 0.93 and 0.92 for CatBoost and XGBoost and an AUC of 0.985 [14]. Liu and Hu combined deep reinforcement learning with a Transformer to model shifting consumer interests from profiles and transaction records [15]. Sun coupled graph convolutional networks with a deterministic policy gradient to optimise personalised recommendation over user-product-query graphs [16]. Wang and Liu mined behavioural trajectories from continuous access logs to predict purchase events [17]. Qi et al. used a KeyBERT-TextCNN pipeline with SHAP over 262,752 reviews to predict and explain perceived risk [12].
We do not claim to advance on any of these in predictive terms, and the comparison would not be meaningful if we did. These studies use behavioural logs, transaction histories, interaction graphs, and review text: data generated as a by-product of platform use, available in volumes two to three orders of magnitude larger than ours, and containing no measurement of what the consumer believed or intended. Our data are the inverse. We measure attitude, subjective norm, and perceived behavioral control directly through a validated instrument, on 352 respondents, with no behavioural log at all. A CatBoost model on 12,330 clickstream sessions and a support vector machine on 352 psychometric responses are not answering the same question, and reporting a higher accuracy on one would say nothing about the other.
What our design permits, and log-based studies structurally cannot, is asking which reported cognitive construct carries the predictive signal, and then checking whether that construct is measured well enough for the question to mean anything. This is the reason the confirmatory factor analysis and discriminant validity checks appear before the classifiers rather than after them. It is also the reason our contribution is a modest one: we are not proposing a new architecture, and we are not extending the Theory of Planned Behavior. We are asking whether TPB constructs, measured in a Bangladeshi social commerce setting, behave as the theory predicts when a non-linear learner rather than a linear structural model is fitted to them, and reporting what happens when those signals are asked to transfer to another population. Both answers turn out to be qualified, and we report the qualifications.




