Log In Sign Up

Unraveling the graph structure of tabular datasets through Bayesian and spectral analysis

In the big-data age tabular datasets are being generated and analyzed everywhere. As a consequence, finding and understanding the relationships between the features of these datasets are of great relevance. Here, to encompass these relationships we propose a methodology that maps an entire tabular dataset or just an observation into a weighted directed graph using the Shapley additive explanations technique. With this graph of relationships, we show that the inference of the hierarchical modular structure obtained by the nested stochastic block model (nSBM) as well as the study of the spectral space of the magnetic Laplacian can help us identify the classes of features and unravel non-trivial relationships. As a case study, we analyzed a socioeconomic survey conducted with students in Brazil: the PeNSE survey. The spectral embedding of the columns suggested that questions related to physical activities form a separate group. The application of the nSBM approach, corroborated with that and allowed complementary findings about the modular structure: some groups of questions showed a high adherence with the divisions qualitatively defined by the designers of the survey. However, questions from the class Safety were partly grouped by our method in the class Drugs. Surprisingly, by inspecting these questions, we observed that they were related to both these topics, suggesting an alternative interpretation of these questions. Our method can provide guidance for tabular data analysis as well as the design of future surveys.


page 7

page 9


MSGNN: A Spectral Graph Neural Network Based on a Novel Magnetic Signed Laplacian

Signed and directed networks are ubiquitous in real-world applications. ...

On spectral embedding performance and elucidating network structure in stochastic block model graphs

Statistical inference on graphs often proceeds via spectral methods invo...

Hierarchical community structure in networks

Modular and hierarchical structures are pervasive in real-world complex ...

A comparison of cluster algorithms as applied to unsupervised surveys

When considering answering important questions with data, unsupervised d...

Using Bayesian Network Analysis to Reveal Complex Natures of Relationships

Relationships are vital for mankind in many aspects. According to Maslow...

1 Introduction

At the end of the nineteenth century, Edmund Landau addressed the problem of how to distribute a money prize among a group of chess players using a table of matches[landauZurRelativenWertbemessung1895]. In a table of matches, each index is associated to a player and the value of each cell represents the result of a match between two players. Landau proposed a method that outperformed the best approaches at the time to perform prize distributions[landauZurRelativenWertbemessung1895, landauUberPreisverteilungBei1915]

. Later on, his method, which is known today as eigenvector centrality, and further developments, encountered a myriad of applications, from fraud detection to rank preferences in a group


Landau’s method scope and limitations would become clear with the emergence of new challenges related to the analysis of tabular data from a variety of domains[ghoshComprehensiveReviewTools2018, adamsSiriusMutualInformation2021]

. For instance, rather than finding the best player, one may want to identify the most important socioeconomic factors to explain the variation inside of a group of people. Rather than finding a probable coalition of players or a group of chess players with similar characteristics and performance, we may want to find a group of health factors that have a similar impact on a group of diseases


To solve these new challenges, recent works[correlatioNet2008, geneNetwork2019, ambriolaokuPotentialConfoundersAnalysis2019, adamsSiriusMutualInformation2021] have been addressing the problem of exploratory analysis of tabular dataset by mapping it to a graph where the features (columns) are mapped to the vertices and edges quantify the relationships between these features. In[correlatioNet2008, geneNetwork2019, adamsSiriusMutualInformation2021], the relationships are modeled by non-directed edges, with edge weights determined based on the mutual information or correlation values. Also, as a result of this construction, the resulting graph has generally multiple disconnected components. These characteristics do not suit the purpose of the current work because in our analysis we take into account the relationships between every pair of features. Also, the directionality of the relationships is another important aspect of our approach.

In [ambriolaokuPotentialConfoundersAnalysis2019], the relationships are modeled by a complete directed graph with weight values expressing by the global feature importance known as “gain” [ganho1987, gradBoostTutorial2013]. Although, the use of gain as an importance variable seems reasonable, this measurement can lead to inconsistent results[shapConsistency2019]

. In addition, it also does not allow the derivation of a local explanation, in the sense of constructing a graph from a single observation (row) or a sample. Because of those previous issues related with tabular to the graph mapping task, we propose here an alternative approach which uses recent developments from tree-based machine learning interpretability techniques

[gradBoostTutorial2013, samekLearningExplainableTrees2020] . More specifically, here we map the dataset into a weighted directed graph with the edge weight obtained through the SHapley Additive exPlanations (SHAP)[lundbergUnifiedApproachInterpreting2017] technique. This technique was chosen for its good properties when compared with other tools to compute the importance of a feature in machine learning task. In addition, it can supply a local interpretation for each object in the dataset. The obtained dense graph, here called called interpretability graph, is initially sparsified, with the goal of removing the weak relationships between features extending the scope of graph analysis methods that can be applied. In particular, we use the disparity filter[serranoExtractingMultiscaleBackbone2009], which is an edge filtering method that has a good performance in preserving the backbone structure of the graph. With the filtered interpretability graph, we show how graph analysis can be employed to interpret the relationships through the graph structure. We discuss with more detail two aspects about this graph: the spectral and the community structure.

As well know in the context of undirected graphs the spectral proprieties of the combinatorial Laplacian have several interesting properties related with the community structure. Those properties motivates in embedding methods for clustering algorithms[spectraldatascience, vignaSpectralRanking2019]

. However, those methods relies in two properties of the combinatorial Laplacian operator: the existence of an orthogonal basis and the fact that the eigenvalues associated with them resides in the real line. Therefore, in the case of our interpretability graph, which is a digraph, those two properties are not satisfied

[Li_Yuan_Wu_Lu_2018]. To overpass that, instead of analyzing the combinatorial Laplacian we have opted to study the spectral information of the magnetic Laplacian operator. The theory and the applications of this magnetic operator has been in recently focus in the literature[f.deresendeCharacterizationComparisonLarge2020, fanuelDeformedLaplaciansSpectral2019, magnet2021], which one of the reasons for that is because the magnetic Laplacian is a Hermitian operator even for directed graphs. More specifically, here we have used the eigenfucntions associated with this operator to map the feature of a tabular dataset into a toroidal space aiming at exploring the data in a more detailed manner.

Meanwhile the analysis of the spectral space can give us a notion about how the features are connected in the interpretability graph in order to explore the community structures we must use a method specifically build for that. Here, we translate the problem of how divide a group of features into classes into finding the communities that the vertex related to those features belong. To do that, we have applied the nested-Sochastic Block Model (nSBM)[peixotoHierarchicalBlockStructures2014, peixotoNonparametricBayesianInference2017, nsbm2021] to infer the hierarchical community structure in our graph. The nSBM revealed hierarchical relationships between the features enabling us to explore and unravel categories that have similar or dissimilar behaviors. Further, we analyze the correspondence between these results and those derived from spectral information associated with the graph.

As an application example, we employed our method to the PeNSE (National Survey of Scholar’s Health, from IBGE) [oliveira2017characteristics] tabular dataset. This periodic survey has been extensively studied across the years in order to understand the health behaviors of students in Brazil; from illicit and licit drugs consumption[pense2014drugs, pense2014drugs2] and health issues[pense2014asthma] to sedentary behavior[pense2020sedentary] . The proposed method allowed us to construct a weighted directed graph from the questions of this survey. The sparsification of the graph and its posterior visualization allowed us to inspect the modular structure of the features. The spectral information of the graph allowed the establishment of a magnetic embedding of the vertices, which indicated that the physical activities questions formed an isolated group.

Our method provided a quantitative way of grouping the questions in an unsupervised fashion. The results showed considerable agreement with the divisions of the survey. For example, we discovered that some questions such as driving behavior were originally aggregated into the class of safety in the design of the survey, but our method suggested that they may present stronger relationships with questions related to the use of drugs. The classes of questions in the survey were probably obtained in a qualitative and subjective way and, therefore, it is natural to expect some structural variations. We believe that the reported results may motivate future works aiming at exploring the effect of interdependence or confounding features in more general tabular datasets, and also provide subsidies to improve the design of surveys.

2 Methods

The Fig.1 describes the method proposed in this work. A weighted directed graph is derived from the original tabular data, with vertices representing the features, and edges representing their relationships, weighted by the SHAP values. As a first measurement, centrality measurements, in this case the hub-score, can be calculated from the obtained graph. An edge filtering approach, namely the disparity filter, is applied to the obtained complete graph, so as to remove the weakest edges. Spectral information, in particular using the deformed magnetic Laplacian operator, allows us to gain additional insight about the data. Finally, the hierarchical modular structure obtained using the nSBM and the SHAP method allows to analyze the entire dataset or just a sample. For example, the responses of a single individual in a survey. The results can be refined based on a subset of the graph and this refinement can be repeated up to a desired granularity.

Figure 1: Flow diagram of the proposed approach. The tabular dataset is initially mapped to a weighted directed graph. The graph is reduced using a graph sparsification approach and used to (1) perform a spectral analysis using the deformed magnetic Laplacian operator and (2) identify similar/dissimilar features using a hierarchical community detection approach. The latter operation can be done iteratively on subgraphs obtained by the previous steps.

In the following, we discuss in more detail the mapping of the tabular dataset into a weighted directed graph, with the weights quantifying how important a feature is to a prediction task.

2.1 Mapping a tabular dataset into a weighted directed graph

Here we discuss how a graph is created based on the tabular dataset. A weighted directed graph is a tuple composed by a set of vertices, , a set of ordered tuples, , and a weight function . Each feature of the dataset associates to at least one vertex of the graph. The directed weighted edges represent the relationships between two columns. Let be the set of columns of the tabular data. A column is randomly chosen and mapped to a set of vertices

. We use the remaining columns as features to train a gradient boosting machine (GBM) to predict the column

. Let be the features columns of c. After training, for each , we understand the weights for each edge () as corresponding to the contribution of the vertex to the task of predicting the vertices related to . We repeat this procedure for each vertex in and obtain a complete weighted directed graph.

A subject of particular importance concerns the contribution of to predict . First, we want to map the tabular dataset to a graph. We require that the in-degree of vertex quantifies the accuracy of the trained GBM, that is . For instance, if a column has no relevant relationship with the remaining columns or cannot be explained by them, the in-degree is low, which reduces the contribution of the vertex to the overall structure of the graph.

This accuracy is used to calculate the weights of the edges. Let be a function that quantifies the contribution of a column associated with to the task of predicting the values of column using the GBM. Here, we choose the weight function of an edge as:


Next we discuss how to choose . To use (1) and consequently, to construct the interpretability graph, it is necessary to choose a way to explain the prediction of a given variable due to the presence of a feature . There is a wide range of methods in the literature to achieve this[molnarInterpretableMachineLearning]. In this work, we opted to use the SHapley Additive exPlanations (SHAP) [samekLearningExplainableTrees2020, lundbergLocalExplanationsGlobal2020]. The SHAP method approximates the Shapley value[kuhnContributionsTheoryGames1953]. The SHAP method was motivated in the theory of cooperation games and works by quantifying the marginal contribution of a feature to a single prediction task.

Since the SHAP value is calculated for each element of the dataset, we have a different graph defined by Eq.(1) for each instance. For example, if the tabular data corresponds to a survey, the graph can be used to study the answers of each person. Although this local exploration allows associating a graph with each instance in the data, in this work we focus on a single graph to describe the entire dataset. In this case, the weight of edge is defined as the mean of the absolute values of SHAP, that is


To calculate each SHAP value, we also need to choose a proper way to handle possible dependencies between features[chenTrueModelTrue2020]. While the tree path approach does not depend on a background dataset and may run faster than causal approaches, the latter is able to deal with feature dependencies using causal inference tools[janzingFeatureRelevanceQuantification2019]. In this work we opted to use the tree path approach in the PeNSE case study due the low computational costs.

2.2 Graph filtering

The obtained interpretability graph is, by construction, complete. As a result, the posterior processing may be difficult or even unfeasible. One of the reasons is the high computational cost associated to the processing of the entire graph. Another reason relates to the excess of information, which may end up blurring the objects of interest[cosciaAtlasAspiringNetwork2021].

A simple approach to reduce the number of edges and to enhance the interpretability of the graph visualization techniques consists in the application of a naive threshold to the edge weights so as to keep just the strongest connections. However, it is hard to choose and justify the value used for the threshold parameter[cosciaAtlasAspiringNetwork2021]. In addition, this method can create many disconnected components.

Figure 4: Graph filtering based on edge weight threshold. A weighted graph (a) and the resulting graph (b) after the removal of weak edges (dashed lines). This approach is highly sensitive to the choice of the threshold: similar threshold values may lead to completely different graphs and remove what is called backbone structures.

In the last decade, a large number of graph filtering methods (a.k.a. graph sparsification) has been developed in order to mitigate the issues present in the naive threshold-based edge filtering approach [serranoExtractingMultiscaleBackbone2009, marcaccioliPolyaUrnApproach2019, batsonSpectralSparsificationGraphs2013]. In this work, we adopted the disparity filter criterion developed by[serranoExtractingMultiscaleBackbone2009] to filter the edges.

Let be the out-degree of a feature associated with the node in the interpretability graph. Defined in this way, is related to the contribution of feature to explain the outputs of all remaining features. Thus quantifies how the the explanation given by the feature in the task of predicting feature contributes to the total amount of interpretability of the feature . Then, with being the out-degree of node , we can associate with each edge the following quantity


Edges with above a given threshold are filtered out. Therefore, this method allows to filter the edges and at the same time keep the graph backbone, as pointed in [serranoExtractingMultiscaleBackbone2009].

2.3 Spectral embedding of the tabular dataset

In the previous sections we discussed the construction of the weighted directed graph from tabular data and how to extract insights from this data structure. Here we discuss how the spectral information of the magnetic Laplacian can be used to unravel clustering of features.

The derivation of the magnetic Laplacian formalism requires decomposing the weight function between a symmetrical and an asymmetrical components. This allows the definition of a flow function in each vertex due to as . With the decomposition, each digraph results in an associated undirected version , which relates to the Laplacian operator, , by:


where .

As can been seen, the combinatorial Laplacian for the undirected graph is symmetric.

The second term of the right hand side of Eq.(4) needs to be modified to deal with the directionality information of the digraph. To do so, the directionality information is treated as a phase perturbation, formally represented by a function whose domain corresponds to the edge set of the directed graph. This function has the following form:


which inserted in the second term of right-hand side Eq.4 gives us the magnetic Laplacian, ,


where is a parameter called charge because of historical reasons[shubinDiscreteMagneticLaplacian1994a].

It is convenient to define a normalized version of the magnetic Laplacian, , as


Noticeably, the magnetic operator can be represented by Hermitian matrx which is not the case of combinatorial operator for digraphs[f.deresendeCharacterizationComparisonLarge2020]. In addition, the magnetic Laplacian is a positive semi-definite operator. The positive semi-definite and hermiticity properties of the magnetic Laplacian allow constructions of physical analogies which can be used to characterize digraphs[f.deresendeCharacterizationComparisonLarge2020]. In addition, the phases of a given eigenvector of the normed magnetic Laplacian (7), capture the notion of circularity in the graph. For example, the phases of the eigenvector associated with the lowest eigenvalue of is the approximated solution for the group synchronization problem related with the magnetic Laplacian[fanuelMagneticEigenmapsVisualization2018]. In mathematical terms this problem searches for a mapping which minimizes the following function


where .

The phases of the second eigenfunction of (

7) also have a remarkable property in the sense that this phase can approximately solve a graph-cut problem[imageSegSpectra, fanuelMagneticEigenmapsVisualization2018].

2.4 Unraveling the structure of the features using the Nested Stochastic Block Model:

In principle, a class of features having similar interpretation behavior should belong to the same community in the proposed interpretability graph. Therefore, to understand the relationships between the features, it is first necessary to define first how these communities can be identified. One possibility to do that is to use a modularity optimization method[Newman_Girvan_2004]. Unfortunately, this method has some drawbacks. For example, it can find communities even in a random graph [guimera2004]. Thus, this can gives to us a meaningless division between the feature of a tabular data. Fortunately, the non-parametric Bayesian method called nested Stochastic Block Model (nSBM)[peixotoHierarchicalBlockStructures2014] mitigates that.

The nSBM method is the hierarchical formulation of the well-known Stochastic Block Model (SBM)[peixotoNonparametricBayesianInference2017, sbmTopicModelScience]. The major difference between SBM and nSBM is that the latter proceeds by agglomerating graph communities into levels, which represent blocks modeled by a SBM. Using this hierarchical construction, nSBM overcomes some issues of its counterpart, such as the inefficiency in identifying small graph communities[peixotoHierarchicalBlockStructures2014].

In essence, the SBM performs a Bayesian inference on a set of parameters of a generative graph model. Such parameters are the vertex partitions, that is, the sizes and the number of blocks, and the probability of connections inside and outside those partitions.

In mathematical terms, let be a set of vertex partitions and the parameters of a given generative model for a graph , the Bayesian problem is given by:


where it is the model evidence.

In this work we used the graph-tool111 implementation of nSBM[peixotoNonparametricBayesianInference2017, sbmNsbm2020]. This method uses the non-parametric framework proposed by Peixoto and it is able to efficiently infer the block-hierarchical structures.

The nSBM allows to understand the modular organization of the graph. Consequently, using this method a user can unravel the relationships between features in the dataset.

2.5 Measuring the relevance of each column

The nSBM method can provide information about how the features in the dataset relate to each other. This information can be useful to investigate the relationships in the data and the existence of redundant features. Another important related question is: how important a feature is to a dataset?

Similarly to [ambriolaokuPotentialConfoundersAnalysis2019], we choose to quantify the importance of a column as a measure of the centrality of the related vertex. For example, we have the eigenvector centrality[vignaSpectralRanking2019], page-rank[irfanReviewDifferentRanking2018a] and hub/authority scores[kleinberg1998authoritative]. Each of these gives a different interpretation about the relevance of a given vertex for the structure of the graph. Here, we analyze just the hub and authority scores for simplicity.

The hub and authority scores were proposed in the context of finding and ranking relevant web pages [kleinberg1998authoritative]. Authoritative pages ideally contain relevant information according to the query and represent the result of the search, while the hubs are linked to the authorities and represent an important element to find the authorities.

Although we needed to filter the interpretability graph to apply the force directed algorithm and the nSBM, the calculation of the hub/authority scores are relatively less expensive, which allows the consideration of the complete graph. Therefore, we evaluated such measures without removing edges.

3 Case study: PeNSE

The adolescence phase may strongly impact adulthood. For this reason, different surveys have focused on the related subjects [grunbaumYouthRiskBehavior2004, currieInequalitiesYoungPeople2008a]. The PeNSE (National Survey of Scholar’s Health) [oliveira2017characteristics] is a survey organized by the Brazilian Institute of Geography and Statistics (IBGE), with collaboration of the Ministry of Health and of the Ministry of Education. Its mission is to better understand the risk factors and health profiles of the teenagers in Brazil.

The three editions of the survey (2009, 2012 and 2015) targeted students regularly enrolled in a Brazilian school, public or private, at the 9th grade, which often corresponds to fourteen-year-old teenagers. This school age was chosen considering the international ethic guidelines of age to conduct socioeconomic questionnaires targeted at the teenagers group. Here we have explored the 2015 edition which inquired almost students in Brazil222The data is public and available here

The survey consists in an electronic questionnaire comprising questions from diverse areas, such as the respondents’ socioeconomic context: parents’ level of education, profession, possession of goods; health, including sexual, oral and mental health; eating habits and the risk factors; family relationships and domestic violence; and the infrastructure provided by the school.

This dataset has already been explored by [levy2010consumo]

, where the authors explored the association between key indicators to sociodemographical profiles. For example, a healthy nutrition indicator, which takes into account the frequency of meals and the consumption of other type of foods, was found to be associated with the age, gender and socioeconomic profile. The analysis was constrained to a linear analysis (linear regression) between these markers. This dataset has also been explored in other works 

[maltaBullyingBrazilianSchools2010, maltaTrendRiskProtective2014b], but focusing on specific set of features, such as related to bullying or chronic diseases.

3.1 Force-directed layout and the effect of the disparity filter

We first discuss how our method could unravel groups of questions in the PeNSE survey. To do so, we first created the interpretability graph as previously discussed and removed less important edges using the disparity filter. In Fig.5 we show the force-directed visualization of both the complete graph (Fig.5(a)) as well as the sparse graph obtained after application of the edges filtering method (Fig.5(b)). The hairy-ball appearance of the complete graph does not allow a direct interpretation. In contrast, when the disparity filter with a was applied to the complete graph, community structures start to appear. A visual inspection shows that the questions related with physical activities seem involve two separated groups. However, as it is well known, the force-directed embedding can be subjectively interpreted by the person who is seeing the graph. Therefore, any insight given by this method should be verified by more formal methods. Thus, in the following we will investigate more about how this group of questions behaves in the spectral space and in the inferred modular structure.

Figure 5: Interpretability graph of the PeNSE dataset. The nodes represent the features and the edges represent the relationship between pairs of features, considering our approach. In (b) the graph was initially filtered using a disparity filter, through (1) with parameter . The vertices disposition is given by the force-directed algorithm. The colour of the vertices/edges corresponds to the group of each variable, provided by the dataset. A good correspondence can be observed the between spatial communities and colours , such as the brown group at the bottom portion of the figure, which indicates that these features are from the same class and were correspondingly joined in the visualization.

3.2 Spectral analysis

Figure 6: Toroidal visualization of the features. Features with higher hub scores are closer to the axial center. A well defined cluster of pink vertices can be observed on the left, which represent questions from class Physical Activities. A magnetic eigenmap embedding with was utilized.

In Fig.6 we present the toroidal embedding using the first two phases of the magnetic Laplacian, with and hub score. The highest hub score questions in the survey according are close to the center. The embedding shows that the questions related to physical activities are grouped in a well separated cluster by the magnetic embedding. Therefore, we must expect that the questions related to physical activities form a group more strongly related with itself. In addition, if a more detailed analysis is requested, a graph-cut approach can been done in the toroidal embedding aiming at removing most of these questions, followed by the application of our method to the reaming columns data aiming at complementing the analysis of other questions.

3.3 Hierarchical categorization of the features

Community detection is generally a hard problem and this difficulty stems, in part, from the the absence of a clear and common definition of what a community is [peixotoHierarchicalBlockStructures2014]. The nSBM approach attempts to mitigate this issue by proposing a statistically principled approach to identify the modular structures. We show in Fig.7 the circular visualization of the filtered interpretability graph of the features in the PeNSE survey provided by nSBM. The directed graph with gray vertices and edges represents the hierarchical structure of the communities of the questions. The vertices are positioned according to the modular structure of the graph and the color of the edges and of the nodes represents the class to which each question belongs in the survey. Such classes were originally defined by the designers of the survey. Thus, communities of vertices with the same color mean a correspondence between the modular structure predicted by the method and the qualitatively classification of the questions in the questionnaire.

Figure 7: Circular visualization [peixotoHierarchicalBlockStructures2014] of the filtered interpretability graph with edge bundling. Vertices in the enclosing circle represent the features and the directed edges show the relationship between two features. Vertices are grouped according to the modular structure and the color of each vertex represents the class of the question in the survey. The overlaid hierarchical structure symbolizes the hierarchy of the communities.

This hierarchical circular visualization in Fig.7 allows different types of analyses, but two are of particular interest regarding the analysis of the survey. The first relates to the positioning and grouping of the vertices and their correspondence with the divisions proposed in the survey. The second has to do with the connections among the areas, i.e., the existence of dominant areas to which a group of features may connect to.

In Fig.7, one can readily see a high correspondence of the obtained grouping of the questions and the divisions of the survey for at least two classes: Food (brown) and Body image (magenta). Whereas the class Safety (pink) presents a considerable agreement, part of the features were positioned by the method separately on the left region of the circle, grouped with questions related to the consumption of drugs (Fig.10(a)). This shows that an alternative classification of the features on the left could be as pertaining to the class of Illicit drugs. Important to emphasize that the nSBM approach is completely automatic and non-subjective, solely based on the pattern of responses in the survey.

Figure 10: Particular groups in the hierarchical community visualization. In (a), part of the features related to safety are located in a separate group, possibly showing a better grouping of the features. In (b), the highlighted features in orange have strong connections to green vertices, which is expected, according to the classification of the features proposed in the questionnaire.

In Fig.10(b), the small group in orange, on the left, is emphasized. This visualization allows us to see that this group has high connectivity to the green group, on the bottom part of the circle. The class in orange corresponds to Food and the highlighted vertices correspond to questions related to eating with parents. The highlighted vertices in green, in turn, represent questions that deal with the relationship of the teenager and their parents. That may be understood as the strong relationship, from the point of view of the student, of a healthy relationship with the parents and sharing regular meals with them. Again, it potentially indicates another possibility of organizing these questions in the questionnaire.

Figure 13: Questions originally categorized as related to Physical Activities. While being positioned close to each other in the circle, they are divided into two groups. In (a) they are related to general sports while in (b) they are related to the activities due to their socioeconomic condition, such as commute on foot.

Furthermore, the hierarchical nature of nSBM allows a more detailed categorization of the features. Most of the questions related to Physical activities (in violet) are positioned in the same region of the circle, but they are grouped into two distinct subgroups (see Fig.13). By inspecting the questions in these subgroups, we noticed that the group in Fig.13(a) is related to entertaining activities, such as playing soccer or dancing, while the other (Fig.13(b)) relates to physical activities required by the socioeconomic condition of the respondent, such as walking or cycling from home to school (see the most relevant questions in Table 1). That is related to the fact that in developing countries mobility relates to the socioeconomic level in different ways [da2008multiple].

The proposed method groups similar questions, such as from Table 1, in nearby regions in the graph. Whereas this analysis could be done manually for visualization purposes, an alternative approach is to performing it automatic and less subjective way. For instance, the questions could be mapped into a vectorial space, tabular2vec. In appendix A, we further discuss this idea and present some results. These preliminary results seem to be consistent with our findings.

“During the last 7 days, in how many days you went on foot or by bicycle to school?”
“During the last 7 days, in how many days you came back on foot or by bicycle to school?”
“When you go to school on foot or by bicycle, how long does it take?”
“When you come back to school on foot or by bicycle, how long does it take?”
Table 1: Questions with highest hub score in the community highlighted in Fig.13(b)

4 Conclusions

Network science (e.g. [newman2003structure]) has largely been used to study artificial and real systems, mainly thanks to its direct formalism on modelling relationships. Knowledge in this field has proven to be useful in the study of a variety of problem and data. In this work we report a method that uses recent developments in machine learning interpretability, as well as community and spectral analysis of graphs to unravel relationships of the features in a tabular dataset. The proposed method differ from related works mainly by: (1) providing the possibility of interpreting the importance of features in predicting each other and, (2) allowing the study of the data to focus on each observation or to encompass the entire dataset.

To perform the graph analysis proposed in this work it was necessary first to develop a method to map a tabular dataset into a graph that avoids the issues present in previous works. In this method, the graph is modelled having features as vertices and the importance of each feature in predicting another as the weight value of the corresponding directed edge. These weights are assigned by considering the SHAP values of respective predictions of a machine learning model. Since the edges weights are computed for each pair of features, the resulting graph is complete. The complexity of this structure restricts the scope for graph analysis methods that can be effectively applied to it. Therefore, the disparity filter criterion was employed to keep just the strong relationships. From the filtered graph, we showed how to use graph analysis methods to extract insights and improve the understanding of the dataset. Specifically, we analyze the the toroidal embedding obtained by the magnetic Laplacian and the nested stochastic block model to unravel how the features of the dataset group into communities. The resulting modular structure, in turn, allows us to analyze the groups according to varying levels of granularity, thanks to its hierarchical grouping capabilities.

The usefulness of our methodology is exemplified respectively to the PeNSE survey dataset. The results showed several findings such as the good overall agreement between the communities obtained and the original qualitative classification of the questions in the survey, especially for the groups Food and Body Image. However, the method also showed that some questions from the class Safety could also be reassigned as Drug Consumption questions. Also, a high connectivity was observed between the questions from the class Food related to eating with parents and questions from the class Situations at Home, maybe related to the harmonious relationship with the parents.

It is important to understand the scope and limitations of the proposed approach while aiming at developing future works. For instance, the obtained graph takes into account the predictions of a machine learning model, but it does not aim at representing a causality graph. Stronger conditions would need to be satisfied to construct such a graph. Also, if the data is composed of few instances, the findings may result strongly biased. As a future work, different tabular datasets like medical, economical, and technical could be considered. We believe also that future works could investigate the use of some synthetic models for generating extensive tabular therefore allowing more systematic investigations of the suggested method in the spectral space. In doing so, it could be possible to establish a more direct connection between the eigenvalues and eigenvectors behavior and the structural dependencies of features.


The authors thank CNPq (grant 307085/2018-0), CAPES and FAPESP (grants 2019/01077-3 and 15/22308-2) for financial support. The authors thank Joao Ricardo Sato, Filipi N. Silva and Thomas Peron and for all suggestions and useful discussions.


Appendix A Features with a similar interpretation structure as revealed by a tabular2vec approach

The hierarchical structure obtained from nSBM provides a mesoscale interpretation of the relationships between the features allowing addressing questions about how we could group different questions in a survey and how strongly those questions are tied. In addition, we could get some clues about factors, as in the case of PeNSE survey. However, suppose that we are seeking for possible data-leaking issues or investigating specific factors in a tabular data. This problem can be translated to Given a feature, what is the set of other features that have the most similar interpretation? One way to answer this is to use a word embedding approach, such as node2vec[node2vec2016], applied in the context of graphs. Here, we performed a node2vec embedding using the interpretability graph. As an example, Table 2

shows the top four questions with the highest cosine similarity to the question

“At school, have you ever received pregnancy prevention counseling?”. Notice that the question “At school, have you ever received advice on how to get condoms for free?”

resulted in a cosine similarity of 0.99 with the reference question, meaning that the embedding of these two different questions is almost the same vector. This is reasonable considering the fact that interviews aiming counseling youngsters about pregnancy would also talk about condoms. Therefore, this suggests that we can use word embedding and the cosine similarity values in order to identify data relationship issues.

Cosine similarity Question
0.99 “At school, have you ever received advice on how to get condoms for free?”
0.98 “At school, have you ever received advice about AIDS or other sexually transmitted diseases?”
0.87 “Have you heard about the vaccination campaign against the HPV virus?”
0.52 “In the last twelve months, how many times did you get involved in a fight (a physical fight)?”
Table 2: Ordered list of most similar questions to: “At school, have you ever received pregnancy prevention counseling?”