My Journey With Predictive Analysis Custom R Scripts
In this rainy sunday, being sent out of home because some serious tidy-up and cleaning going on inside home 🙂
i decided i will find somewhere to grab a coffee, listen to some awesome music and explore possibilities with R programming.
Since i am not very proficient in coding, i will look for some ready code on the internet and will try to adapt it.
I believe some social media content will really make my demos and presentations shine, so let’s see what we can do with Facebook API.
Result component link is at the bottom of this page, ready to be used,
What we want to achieve? See this viz.
First Step :
Log on to FB, visit this page, click on “get access token” (dont forget to authorize for friends data) :
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 🙂
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.
Happy coding 🙂