<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Datablend &#187; circos</title>
	<atom:link href="https://datablend.be/?cat=33&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://datablend.be</link>
	<description>Big Data Simplified</description>
	<lastBuildDate>Mon, 07 Sep 2015 09:04:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6.1</generator>
		<item>
		<title>Coalition-Cocktail &#8211; Hacking the Elections @ Engagor</title>
		<link>https://datablend.be/?p=440</link>
		<comments>https://datablend.be/?p=440#comments</comments>
		<pubDate>Tue, 27 May 2014 14:57:42 +0000</pubDate>
		<dc:creator>Davy Suvee</dc:creator>
				<category><![CDATA[circos]]></category>
		<category><![CDATA[engagor]]></category>
		<category><![CDATA[gephi]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hackaton]]></category>
		<category><![CDATA[vk14]]></category>

		<guid isPermaLink="false">http://datablend.be/?p=440</guid>
		<description><![CDATA[Last weekend, Engagor organised their hacktheelections hackaton. The Datablend team (Quentin, Stijn and Davy) was joined by Marc Broos, Tim Coene and Josbert van de Zande with one goal in mind: trying to visualise the (pre-arranged?) political coalition and, if possible, also predict the formation-period. Technically, we extracted over 160K tweets through the Engagor API.<p><a href="https://datablend.be/?p=440">Continue Reading →</a></p>]]></description>
				<content:encoded><![CDATA[<p style="text-align: left;">Last weekend, <a title="Engagor" href="https://engagor.com" target="_blank">Engagor</a> organised their <a title="hacktheelections" href="http://www.hacktheelections.com" target="_blank">hacktheelections</a> hackaton. The Datablend team (Quentin, Stijn and Davy) was joined by Marc Broos, Tim Coene and Josbert van de Zande with one goal in mind: trying to visualise the (pre-arranged?) political coalition and, if possible, also predict the formation-period.</p>
<p style="text-align: left;">Technically, we extracted over 160K tweets through the Engagor API. Next, a &#8220;sentiment&#8221;-based political graph was build and stored in the <a href="http://www.neo4j.org" title="Neo4J" target="_blank">Neo4J</a> graph database. A <a href="http://www.gephi.org" title="Gephi" target="_blank">Gephi</a>-based visualisation, based upon community detection, revealed the &#8220;truth&#8221;, which was, to be honest, a bit disappointing and at the same time somewhat expected: the political parties from Wallionia form a solid community while the Flemish parties are interconnected through many clusters. A warning sign for the upcoming formation process?</p>
<p style="text-align: left;">The slidedeck below provides an overview of the single day of hacking. Our results ranked third (on 8 teams). Although being very informative, it&#8217;s quite hard to compete with a &#8220;pokemon&#8221;-themed fighting animation between politicians *wink*. Many thanks to <a title="Engagor" href="https://engagor.com" target="_blank">Engagor</a> for the spotless organisation!</p>
<p><center><iframe src="http://www.slideshare.net/slideshow/embed_code/35157124" width="600" height="489" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe><br/><br/></center></p>
<p></p>]]></content:encoded>
			<wfw:commentRss>https://datablend.be/?feed=rss2&#038;p=440</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Circle through your Google Analytics data with Neo4J and Circos</title>
		<link>https://datablend.be/?p=267</link>
		<comments>https://datablend.be/?p=267#comments</comments>
		<pubDate>Sun, 11 Mar 2012 09:51:19 +0000</pubDate>
		<dc:creator>Davy Suvee</dc:creator>
				<category><![CDATA[circos]]></category>
		<category><![CDATA[neo4j]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[visualisation]]></category>

		<guid isPermaLink="false">http://datablend22.lin3.nucleus.be/?p=267</guid>
		<description><![CDATA[Storing massive amounts of data in a NoSQL data store is just one side of the Big Data equation. Being able to visualize your data in such a way that you can easily gain deeper insights, is where things really start to get interesting. Lately, I&#8217;ve been exploring various options for visualizing (directed) graphs, including<p><a href="https://datablend.be/?p=267">Continue Reading →</a></p>]]></description>
				<content:encoded><![CDATA[<p style="text-align: justify;">Storing <span class="highlight">massive amounts of data</span> in a NoSQL data store is just one side of the <span class="highlight">Big Data</span> equation. Being able to visualize your data in such a way that you can easily gain <span class="highlight">deeper insights</span>, is where things really start to get interesting. Lately, I&#8217;ve been exploring various options for visualizing (directed) graphs, including <a href="http://circos.ca/" target='_blank'>Circos</a>. Circos is an amazing software package that visualizes your data through a <span class="highlight">circular layout</span>. Although it&#8217;s originally designed for displaying <span class="highlight">genomic data</span>, it allows to create good-looking figures from data in any field. Just transform your data set into a tabular format and you are ready to go. The figure below illustrates the core concept behind Circos. The table&#8217;s <span class="highlight">columns</span> and <span class="highlight">rows</span> are represented by <span class="highlight">segments</span> around the circle. Individual <span class="highlight">cells</span> are shown as <span class="highlight">ribbons</span>, which <span class="highlight">connect</span> the corresponding row and column segments. The ribbons themselves are <span class="highlight">proportional</span> in width to the value in the cell.</p>
<p>&nbsp;</p>
<p><a target='_blank' href="http://datablend.be/wp-content/uploads/circos-visualize-table.png">
<p align="center"><img width="400" src="http://datablend.be/wp-content/uploads/circos-visualize-table.png" alt="circos" /></p>
<p></a>  </p>
<p>&nbsp;</p>
<p style="text-align: justify;">When visualizing a <span class="highlight">directed graph</span>, nodes are displayed as segments on the circle and the size of the ribbons is proportional to the value of some property of the relationships. The proportional size of the segments and ribbons with respect to the full data set allows you to easily identify the <span class="highlight">key data points</span> within your table. In my case, I want to better understand the <span class="highlight">flow of visitors</span> to and within the datablend site and blog; where do visitors come from (direct, referral, search, &#8230;) and how do they navigate between pages. The rest of this article details how to 1) retrieve the <span class="highlight">raw visit information</span> through the Google Analytics API, 2) <span class="highlight">persist</span> this information <span class="highlight">as a graph</span> in Neo4J and 3) query and <span class="highlight">preprocess</span> this data for visualization through Circos. As always, the complete source code can be found on the <a target='_blank' href="https://github.com/datablend/neo4j-google-analytics">Datablend public GitHub repository</a>.</p>
<p>&nbsp;</p>
<h3>1. Retrieving your Google Analytics data</h3>
<p style="text-align: justify;">Let&#8217;s start by retrieving the <span class="highlight">raw Google Analytics data</span>. The Google Analytics data API provides access to all <span class="highlight">dimensions</span> and <span class="highlight">metrics</span> that can be queried through the web application. In my case, I&#8217;m interested in retrieving the <span class="highlight"><em>previous page path</em></span> property for each page view. If a visitor enters through a page outside of the datablend website, the <em>previous page path</em> is marked as <span class="highlight"><em>(entrance)</em></span>. Otherwise, it contains the <span class="highlight">internal path</span>. We will use Google&#8217;s Java Data API to connect and retrieve this information. We are particularly interested in the <span class="highlight"><em>pagePath</em></span>, <span class="highlight"><em>pageTitle</em></span>, <span class="highlight"><em>previousPagePath</em></span> and <span class="highlight"><em>medium</em></span> dimensions, while our metric of choice is the number of <span class="highlight"><em>pageViews</em></span>. After setting the date range, the <span class="highlight">feed of entries</span> that satisfy this criteria can be retrieved. For ease of use, we transform this data to a domain entity and filter/clean the data accordingly. If a visit originates from outside the datablend website, we store the specific <span class="highlight">medium</span> (direct, referral, search, &#8230;) as previous path.</p>
<script src="https://gist.github.com/2011682.js"></script>
<p>&nbsp;</p>
<h3>2. Storing navigational data as a directed graph in Neo4J</h3>
<p style="text-align: justify;">The set of site navigations can easily be stored as a directed graph in the the <span class="highlight">degree</span> of my nodes is correct if I would perform other types of calculations. For each individual navigation relationship, we also store <span class="highlight">the date of visit</span>.</p>
<script src="https://gist.github.com/2011787.js"></script>
<p>&nbsp;</p>
<h3>3. Creating the Circos tabular data format</h3>
<p style="text-align: justify;">The <span class="highlight">Circos tabular data format</span> is quite easy to construct. It&#8217;s basically a <span class="highlight">tab-delimited file</span> with row and column headers. A cell is interpreted as a <span class="highlight">value</span> that <span class="highlight">flows</span> from the <span class="highlight">row entity</span> to the <span class="highlight">column entity</span>. We will use the <a target='_blank' href="http://docs.neo4j.org/chunked/stable/cypher-query-lang.html">Neo4J Cypher query language</a> to retrieve the data of interest, namely all navigations that occurred within a <span class="highlight">certain time period</span>. Doing so allows us to create <span class="highlight">historical visualizations</span> of our navigations and observe how visit flow behaviors are changing over time.</p>
<script src="https://gist.github.com/2011910.js"></script>
<p>&nbsp;</p>
<p style="text-align: justify;">Next, we create the tab delimited file itself. We <span class="highlight">iterate</span> through all entries (i.e. navigations) that match our Cypher query and store them in a temporary list. Afterwards, we start building the <span class="highlight">two-dimensional array</span> by <span class="highlight">normalizing</span> (i.e. summing) the number of navigations between the source and target paths. At the end, we <span class="highlight">filter</span> this occurrence matrix on the <span class="highlight">minimal number</span> of required navigations. This ensures that we will only create segments for paths that are <span class="highlight">relevant</span> in the total population. As a final step, we <span class="highlight">print</span> the occurrences matrix as a tab-delimited file. For each path, we will use a <span class="highlight">shorthand</span> as the Circos renderer seems to have problem with long string identifiers.</p>
<script src="https://gist.github.com/2011992.js"></script>
<p>&nbsp;</p>
<p style="text-align: justify;">The text below is a sample of the output generated by the <span class="highlight"><em>printCircosData</em></span> method. It first prints the legend (matching shorthands with actual paths). Next it prints the tab-delimited Circos table.</p>
<script src="https://gist.github.com/2012044.js"></script>
<p>&nbsp;</p>
<h3>4. Use the Circos power</h3>
<p style="text-align: justify;">Although Circos can be installed on your local computer, we will use its <a target='_blank' href="http://mkweb.bcgsc.ca/tableviewer/">online version</a> to create the visualization of our data. Upload your tab-delimited file and just wait a few seconds before enjoying the <span class="highlight">beautiful rendering</span> of your site&#8217;s navigation information.</p>
<p><a target='_blank' href="http://datablend.be/wp-content/uploads/circos1.jpg">
<p align="center"><img width="700" src="http://datablend.be/wp-content/uploads/circos1.jpg" alt="circos" /></p>
<p></a>  </p>
<p style="text-align: justify;">With just a glimpse of an eye we can already see that the <span class="highlight">l3-segment</span> (i.e. the referrals) is significantly larger (almost 6000 navigations) compared to the others segments. The <span class="highlight">outer 3 rings</span> visualize the total amounts of navigations that are <span class="highlight">leaving</span> and <span class="highlight">entering</span> this particular path. In case of referrals, no navigations have this path as target (indicated by the empty middle ring). Its <span class="highlight">total segment count</span> (inner ring) is entirely build up out of navigations that have a referral as source. The <span class="highlight">l6-segment</span> seems to be the path that attracts the most traffic (around 2500 navigations). This segment visualizes the navigation data related to my <a target='_blank' href="http://datablend.be/?page_id=44&#038;paged=2">&#8220;The joy of algorithms and NoSQL: a MongoDB example&#8221;</a>-article. Most of its traffic is received through referrals, while a decent amount is also generated through <span class="highlight">direct</span> (l17-segment) and <span class="highlight">search</span> (l27-segment) traffic. The <span class="highlight">l15-segment</span> (my blog&#8217;s main page) is the only path that receives an almost equal amount of incoming and outgoing traffic.</p>
<p style="text-align: justify;">With just a few tweaks to the Circos input data, we can easily <span class="highlight">focus</span> on particular types of navigation data. In the figure below, I made sure that referral and search navigations are visualized more prominently through the use of 2 separate colors.</p>
<p><a target='_blank' href="http://datablend.be/wp-content/uploads/circos2.jpg">
<p align="center"><img width="700" src="http://datablend.be/wp-content/uploads/circos2.jpg" alt="circos" /></p>
<p></a>  </p>
<h3>5. Conclusions</h3>
<p style="text-align: justify;">In the era of Big Data, visualizations are becoming crucial as they enable us to mine our large data sets for certain patterns of interest. Circos specializes in a very specific type of visualization, but does its job extremely well. I would be delighted to hear about other types of visualizations for directed graphs.</p>
<p></p>]]></content:encoded>
			<wfw:commentRss>https://datablend.be/?feed=rss2&#038;p=267</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
