Here’s the github link to the original code i found online. it gets your friend list and their friends to plot a network cluster to visualize their connections to each other. Will be intresting to try:

We have to wrap this inside a function, add a print to actually plot the graph, make the api key a variable so we can pass from the algorithm properties page.

Now let’s configure our key and run the component :

Run the component and…!!!

The code basically plots the clusters, and creates a legend to show names of people right on the center of each cluster. You chan tweak the code to change plot parameters which will probably make it look visually more appealing, like this :

Looking at the plot and names which i didnt include in the screenshot, i understand that they are mainly :

1) Work network

2) University friends

3) High-school friends,

4) Elementary school friends (yes we did find each other via facebook 🙂

5) Family

I believe that’s a simple enough example of what clustering is, understanding different subcategories amongst a big list.

My next aim will be to replicate something similar but using a “product page” from facebook, visualizing people who “liked” the page. Any help is highly apreciated

Here’s the re-usable component for SAP Predictive Analysis, download it and paste it into the apropriate folder which may look like

C:\Users\”usernamecomeshere”\SAP Predictive Components\RScript

Please note that the code is provided “as-is” and is not supported by SAP.