For this guide we have to use IBM Bluemix. In our previous guides we talked about how to use Jupyter Notebook, IBM Data Science Experience software, How To Run Docker, Containers On IBM Bluemix, Jupyter Notebook on IBM Bluemix in old way, Python libraries for Data Science, a WordPress Plugin showing usage of Watson Tone Analyser, cognitive data analysis etc. These things are modern and often needed by the small developers. As Example usage, we can pull csv data from Facebook Analytics to Jupyter Notebook for cognitive data analysis with IBM Watson & Jupyter Notebook. The basics of this guide was published on official IBM’s website.
Facebook Analytics Cognitive Data Analysis : Jupyter Notebook & IBM Watson
The basic is that – we need to export the CSV file from Facebook Analytics and add to DSX Object Storage. The generated code will make the file accessible as a pandas DataFrame. The data is enriched with Watson Natural Language Understanding, Watson Tone Analyzer, Watson Visual Recognition and can be explored with PixieDust to create graphics to highlight them.
In Data Science Experience, there will be DSX-Spark and DSX-ObjectStore services. We can create the notebook in IBM Data Science Experience using the URL of the notebook that is in Github git repo by clicking Menu on the left to select My Projects and then Default Project > Add notebooks (upper right) to create a notebook > Select the From URL tab > Enter Notebook URL:
---
1 | https://github.com/IBM/pixiedust-facebook-analysis/blob/master/notebooks/pixiedust_facebook_analysis.ipynb |
Then click the Create Notebook button. We will create few IBM Cloud services by clicking the Deploy to Bluemix button – Visual Recognition, Natural Language Understanding and Tone Analyzer.
Find the notebook cell “Add Service Credentials From IBM Cloud for Watson Services”. Replace
with Service Credentials from IBM Bluemix dashboard, one example what we are talking about :
1 2 3 4 5 | # @hidden_cell # Watson visual recognition VISUAL_RECOGNITION_API_KEY = '<add_vr_API_key_value>' # ... |
Now click Find and Add Data and its Files tab (icon is 10/01) from where there you can click browse and add Facebook Analytics .csv
file already downloaded on your computer.
Find the notebook cell “Load data from Object Storage”. Click to get cursor after # Insert pandas DataFrame
line. Make sure that this cell is selected before inserting code. Using the file that you added above, click to use the Insert to code drop-down menu. Select Insert Pandas DataFrame from the drop-down menu.
You need to fix the name of generated method with credentials and then calls the generated method to set a variable with a name like df_data_1
. Use the same file drop-down to insert credentials to make sure it is enriched file. There is a cell to enter the file credentials. Use the CSV file’s drop-down menu to select Insert Credentials.
Now run the Notebook.
You can read instructions on this GitHub repo as additional support :
1 | https://github.com/AbhishekGhosh/pixiedust-facebook-analysis |