Understanding Friendship Formation with Explainable Machine Learning

María Pereda 1 2 · 2026

Read Understanding Friendship Formation with Explainable Machine Learning by María Pereda 1 2 (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2603-19845.txt.

Introduction

Pereda studies how friendships form among 3,395 students, using an explainable boosting model. The model predicts whether a tie is positive or negative. Inputs cover traits like prosociality, reflection skill, and gender, plus triadic influence from the local network. Triadic influence dominates the predictions by a wide margin. Traits matter most for a small share of ties, about 0.24 percent. Those ties tend to be weaker, more often negative, and less balanced. The results support a layered view of tie formation.

Catalog record

CREATORMaría Pereda 1 2
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE40299
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2603.19845

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Understanding Friendship Formation with Explainable Machine Learning María Pereda 1 2 Abstract Understanding the formation of social ties requires disentangling the roles of individual traits and local network structure. We analyse signed social relationships among 3,395 students using an interpretable machine learning model—the Explainable Boosting Machine (EBM)—to predict link polarity from individual attributes (prosociality, cognitive reflection, and gender) and a structural metric, triadic influence. Our results show that triadic influence overwhelmingly dominates link prediction, confirming that local network structure is the primary driver of social relationships. Nevertheless, a small subset of links (0.24%) is primarily explained by individual-level traits. A detailed characterisation of this subset reveals that these links do not arise from distinct structural conditions, but rather correspond to weaker and less structurally embedded relationships. In particular, they are more likely to be negative ties and exhibit lower levels of structural balance, whereas triadic-dominant links are strongly associated with positive relationships and highly balanced configurations. Furthermore, we find that links without indirect structural paths are not explained by individual traits, but by the absence of structural reinforcement itself. Taken together, these findings support a layered view of social tie formation, in which structural mechanisms dominate globally, while individual-level effects emerge in specific, less constrained contexts. More broadly, our work highlights the value of explainable machine learning for uncovering the mechanisms underlying social network formation. † † institute: Grupo de Investigación Ingeniería de Organización y Logística (IOL), Departamento Ingeniería de Organización, Administración de empresas y Estadística, Escuela Técnica Superior de Ingenieros Industriales, Universidad Politécnica de Madrid, 28006 Madrid, Spain, , and Grupo Interdisciplinar de Sistemas Complejos (GISC), 28911 Leganés, Madrid, Spain 1 Introduction Social networks shape human interactions from early childhood to adult life, but the mechanisms behind the formation of individual social ties remain elusive. In particular, understanding whether friendships emerge primarily from intrinsic individual traits or from the social environment is a longstanding question in network science. In a recent study ruiz2023triadic , it was shown that the sign of a relationship between two students—friendship or enmity—could be accurately predicted using a simple structural metric called triadic influence . This measure quantifies the effect of indirect paths of length two between two students, capturing the mediating role of mutual contacts. Interestingly, triadic influence alone outperformed models that included personal traits such as gender, cognitive reflection, or prosociality. These findings suggest that local structural features can act as a proxy for deeper compatibility traits that may be otherwise difficult to measure directly. Despite the strong performance of triadic influence, the same study observed that in the absence of such structural paths—that is, for isolated links without directed paths of length two—the prosociality of both students still yielded predictions that were better than random. This points to a plausible scenario where prosociality drives the nucleation of early links, which are later embedded in growing triadic structures that take over as dominant mechanisms of network formation. In this work, we revisit this hypothesis from a different perspective. Rather than using black-box models like deep neural networks, our goal is to interpret link formation in these networks by identifying which features—individual or structural—most strongly influence it. To this end, we perform a systematic comparison of machine learning classifiers, selecting among them the Explainable Boosting Machine (EBM) for its combination of strong predictive performance and interpretability. EBMs are a type of Generalized Additive Model that learn transparent feature-wise effects, making them ideal for uncovering the roles of individual traits and local topology in a controlled and explainable manner. Our analysis confirms that: (I) triadic influence remains the strongest overall predictor of the sign of relationships; (II) for a subset of links, the EBM attributes the prediction not primarily to triadic influence but to individual-level traits such as prosociality or cognitive style; (III) these links predominantly involve first-year students, suggesting that time spent within the social environment plays a key role in shaping the mechanisms behind link formation; (IV) although the study in ruiz2023triadic suggested that individual traits might explain links without structural paths, we find that all such relationships (i.e., those with A^{2}_{ij}=0 ) are entirely captured by their triadic influence value—zero in this case—and none are attributed to personal characteristics. Through the lens of explainable machine learning, we provide new insight into the mechanisms of friendship formation in adolescent networks, and offer evidence consistent with a two-stage dynamic: early links forming under different conditions—potentially before structural patterns stabilize—and later links being more predictable via structural mechanisms such as triadic closure. 2 Methods Dataset and Features We use publicly available data from a previous study ruiz2023triadic , comprising self-reported signed social relationships among 3,395 students from 13 secondary schools in Spain. Each directed link represents a declared relationship from student i to student j , with ratings categorized into four levels (from -2 : “very bad” to +2 : “very good”). For binary classification, we focus on links labeled as either friendship ( +2 ) or enmity ( -2 or -1 ). Each student is also characterized by three individual traits: • Gender , self-reported (male, female, non-binary). • Cognitive reflection , assessed via the standard three-question Cognitive Reflection Test (CRT) Branas-Garza2019CognitiveWhen . The CRT captures the tendency to override an intuitive but incorrect answer in favour of a more deliberate response. The score ranges from 0 to 3, corresponding to the number of correct responses. • Prosociality , operationalised through a set of three economic choice questions inspired by experimental paradigms on distributional preferences Fehr2008EgalitarianismChildren AlfonsoCostillo2022TheTeenagers , scaled to the interval [0,1] . In addition to individual traits, we include a network-based feature: triadic influence ruiz2023triadic , defined as the sum over all directed paths of length 2 from i to j : I_{ij}=\sum_{k}w_{ik}w_{kj}. This metric captures the indirect social context influencing the i\rightarrow j link and has been shown to strongly correlate with link polarity. Classification and Model Selection Our task consists in predicting the sign of a directed relationship between two students. Input features include individual traits for both students and/or the triadic influence between them. We compare four classifiers: two deep neural networks (TensorFlow, PyTorch), XGBoost, and the Explainable Boosting Machine (EBM). All models are optimised using stratified nested cross-validation (5 outer and 5 inner folds) Anderssen2006ReducingValidation Varma2006BiasSelection to ensure robustness and unbiased performance estimation. To address the class imbalance present in the dataset, we incorporated Random OverSampling within the training pipeline. This oversampling step is applied exclusively to the training folds during each iteration of the nested cross-validation, thereby preserving the integrity of the validation folds and preventing data leakage. Embedding oversampling within the pipeline ensures that the resampling procedure is integrated seamlessly with feature scaling and model fitting, promoting a more robust and unbiased estimation of the model’s generalisation performance. In addition, all feature variables were standardised using StandardScaler to ensure zero mean and unit variance, as required by several machine learning algorithms (e.g., distance-based and regularised models). Due to class imbalance, we report balanced accuracy (mean of true positive and true negative rates) as our main evaluation metric (table 1 ). Table 1 : Balanced accuracy and standard deviation (SD) across models. Model Accuracy SD Key Hyperparameters TF Neural Network 0.824 0.005 hidden_units=32, lr=0.001, batch=32 PyTorch

Read the complete text