Visualizing text analytics using jsfiddle.net (and friends!)
In previous blog posts we’ve talked about ways of visualizing the results of various simple analytics generated using Infinit.e plugins: geographic analyses in Pentaho and R, and more complex temporal analytics in R. In this post, we’ll show one of our favorite ways of quickly creating and sharing valuable visualizations using the excellent jsfiddle web-site.
All “fiddles” are public and can be shared with anyone, but the JSONP requests to the Infinit.e server get the browser’s authorization cookie, which provides a built-in security layer, where only users with access to the data in question can see the visualization.
Jsfiddle provides 3 input windows, and 1 output window that can be made full screen once the code is working:
- HTML: hosts the “view layer” – in our cases this is normally just a “<div>” (or similar) containing the component provided by an external library.
- CSS: this can be used to style the final display – we normally leave it alone.
External libraries can be loaded easily using the sidebar for both asynchronous requests to the Infinit.e API and for the ensuing visualizations. For the following examples, we used:
- Mootools-1.3.2 framework to provide a jQuery-like JSONP call back to the Infinit.e API
- Google Charts to provide a timeline: http://www.google.com/jsapi?ext.js
- protovis to provide a scatterplot: http://mbostock.github.io/protovis/
- Load the data using Mootools
- Format the data according to the specifications of the visualization you want to use
- Launch the graph or visualization
Visualizing Daily Sentiment from E-Mails
We used Mootools to load the data and then formatted it to the specifications for the Google Charts timeline (just like the finance.google.com graphs!). Finally, we launched the graph. Each of these sections is outlined below:
If you want to share the visualization publicly (and have confirmed that the data has no access restrictions!) then you can simply save the results of the API call to disk and then share it on a file hosting site such as dropbox, box.net,or from your web hosting account. If the resulting data is small enough then it can also be pasted directly into another jsfiddle. The following link provides the full fiddle but with the API call commented out and replaced with a static version of the data requiring no authentication: http://jsfiddle.net/AlexAtIkanow/xusqA/.
Visualizing Clusters of Similar Tweets
In this slightly more complex example, we used Mahout to cluster 5,000 tweets discussing Superstorm Sandy using SVD. Both our community and enterprise editions provide some level of built-in support for this powerful Hadoop-based machine learning language. This particular analytic matches up shared keywords across the tweets to convert each one into a point in 3-dimensional space, where two points’ being close indicates that they have similar content.
Then we used protovis to show a scatter plot of the projected tweets, with color used as the third dimension. Protovis has since evolved into the more sophisticated d3.js – but we still often prefer the earlier version to get up and running quickly, as we’ve discussed in a previous post.
- Load the data using Mootools
- Format the data according to the protovis requirements
- Launch the graph
Only the 3rd step is more complicated – because the functionality provided is more sophisticated and requires more complex configuration.
The generated web pages can be shared either openly by saving the API call from the browser and uploading to a site like dropbox or connecting to the API each time to provide access security.
A forthcoming blog post will showcase some new widgets that provide configurable views of custom analytics within the existing Infinit.e GUI framework.
Interested in receiving quarterly newsletters from IKANOW?
Learn more from IKANOW:Visit the Resource Center