Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: [email protected]
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Publication

Extracting communities from Social Graph Network
Latest

Extracting communities from Social Graph Network

Last Updated on February 2, 2022 by Editorial Team

Author(s): Naveed Ahmed Janvekar

Originally published on Towards AI the World’s Leading AI and Technology News and Media Company. If you are building an AI-related product or service, we invite you to consider becoming an AI sponsor. At Towards AI, we help scale AI and technology startups. Let us help you unleash your technology to the masses.

Data Science

Clustering using Social GraphΒ Network

A Social Graph Network can be formed when there are a set of connections between entities (nodesβ€Šβ€”β€Šsuch as people or organizations) and interactions (edgesβ€Šβ€”β€Šsuch as friendship, contracts) between them. In today’s world, there are many social networks that existβ€Šβ€”β€Ša famous one being Facebook’s friend’s network. However, as long as we can establish connections between various entities, we can represent many things around us as a social network or aΒ graph

Benefits of social graphΒ networks

Measures of influence such as degree centrality, eigenvector centrality can be generated from these graphs for every node. The connections or edges that a node shares with other nodes in the graph can also be represented as vectors using methodologies such as Node2Vec and these vectors can be used as features for clustering or even features for supervised learningΒ models.

By using these vectors in supervised learning models, the objective would be to improve performance, while using them in clustering would be to find groups of nodes that share similar sub-graph structures within the entire social network. These groups can then be used for recommendations, customer segmentation, fraud detection, and soΒ on.

What are node2vec embeddings?

Node2Vec is an algorithm developed by Aditya Grover and Jure Leskovec to represent nodes within a graph in the form of vectors. Vector representation of nodes is based on random walks within the graph. The algorithm takes inspiration from the workings of word2vec. These vectors can then be used in other machine learning tasks such as features in supervised or unsupervised learning. More details of the algorithm can be found here https://arxiv.org/pdf/1607.00653.pdf

Implementation of node2vec on a social networkΒ graph

In this article node2vec algorithm is implemented on a network graph that is generated from the SNAP Dataset Facebook Gemsec dataset. https://snap.stanford.edu/data/gemsec-Facebook.htmlΒ . This dataset represents blue verified Facebook page networks of different athletes. Nodes represent the pages of athletes and edges are mutual likes amongΒ them.

Step1: Import necessary packages and read data into a pandas dataΒ frame

There are 13K nodes and 86K edges betweenΒ them.

Step 2: Running Node2Vec on the edge list which is extracted from the pandas data frame. An edge is a relationship connecting nodes. A graph object is created from this edge list. To create the graph object we use the networkxΒ package.

Below commands will generate embeddings with 64 dimensions, and this is a parameter that can be optimized for.

Step 3: Embeddings for all the nodes in the graph is extracted and stored in a pandas dataΒ frame

Step 4: Clustering: On running a K-Means clustering we get distinct clusters/communities which we will later on use to visualize these embeddings. For this article we are assuming 5 clusters, however, there are methods such as scree plot to identify an optimal number of clusters forΒ K-Means.

Visualization embedding and clustering results:

To get a visual perspective of the embeddings generated we reduce the dimensions using Principal Component Analysis (PCA), and combine the generated dimensions with the clusters from the above step. Make sure to remove the cluster column before runningΒ PCA.

From the above plot, we can visualize 5 different clusters or communities that can be extracted by generating embedding vectors from graph networks. These clusters can now be used to further deep dive for tasks such as customer segmentation.


Extracting communities from Social Graph Network was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Join thousands of data leaders on the AI newsletter. It’s free, we don’t spam, and we never share your email address. Keep up to date with the latest work in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.

Published via Towards AI

Feedback ↓