<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Analytics on Ha Pham</title><link>http://hoanghapham.github.io/tags/analytics/</link><description>Recent content in Analytics on Ha Pham</description><generator>Hugo -- 0.167.0</generator><language>en-us</language><lastBuildDate>Mon, 07 Feb 2022 20:42:18 +0700</lastBuildDate><atom:link href="http://hoanghapham.github.io/tags/analytics/index.xml" rel="self" type="application/rss+xml"/><item><title>Generate Run-Length ID With SQL</title><link>http://hoanghapham.github.io/posts/generate-run-length-id-with-sql/</link><pubDate>Mon, 07 Feb 2022 20:42:18 +0700</pubDate><guid>http://hoanghapham.github.io/posts/generate-run-length-id-with-sql/</guid><description>&lt;h1 id="what-is-run-length-id"&gt;What is run-length ID?&lt;/h1&gt;
&lt;p&gt;Sometimes during analysis work, you need to group &lt;strong&gt;consecutive sequence of values&lt;/strong&gt; into different &amp;ldquo;runs&amp;rdquo;, and calculate metrics for each run. For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Given a time series recording some entity&amp;rsquo;s state, you want to calculate on average, how long does an entity stay in a particular state.
&lt;img loading="lazy" src="http://hoanghapham.github.io/generate-run-length-id-with-sql/consecutive_runs.png"&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Or a more specific example: Given a series of event data of several users, you want to group the users&amp;rsquo; events into sessions with a session cut-off threshold of your choice
&lt;img loading="lazy" src="http://hoanghapham.github.io/generate-run-length-id-with-sql/user_events.png"&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Vietnam bombing history with data - Part 2: Rolling Thunder Operation</title><link>http://hoanghapham.github.io/posts/vietnam-bombing-history-p2/</link><pubDate>Sat, 13 Apr 2019 00:00:00 +0700</pubDate><guid>http://hoanghapham.github.io/posts/vietnam-bombing-history-p2/</guid><description>&lt;p&gt;You can read Part 1 &lt;a href="http://hoanghapham.github.io/posts/vietnam-bombing-history-p1/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Full code to produce the charts and report: &lt;a href="https://github.com/hoanghapham/vietnam_war_bombing"&gt;https://github.com/hoanghapham/vietnam_war_bombing&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;There are many notable operations happened during the Vietnam War: Rolling Thunder, Steel Tiger, Barrel Roll, Line Backer, Line Backer II… However, I chose to explore Rolling Thunder because of its interesting nature: the bombing strategy of the operation changed over time due to the U.S. policy against China and the Soviet.&lt;/p&gt;
&lt;h1 id="the-evolution-of-the-operation"&gt;The evolution of the operation&lt;/h1&gt;
&lt;p&gt;After Geneva conference in 1954, the U.S. replaced France as a political backup for Ngo Dinh Diem in the South Vietnam. They believed in the “domino effect”, which suggested that if Vietnam fell under the influence of communism, all countries around would follow.&lt;/p&gt;</description></item><item><title>Vietnam bombing history with data - Part 1</title><link>http://hoanghapham.github.io/posts/vietnam-bombing-history-p1/</link><pubDate>Sun, 04 Nov 2018 00:00:00 +0700</pubDate><guid>http://hoanghapham.github.io/posts/vietnam-bombing-history-p1/</guid><description>&lt;p&gt;History as taught in Vietnam schools is boring. Modern war history is even more boring, because of the very unattractive way textbooks present the narrative of war. We were taught that our army is brave, noble and great, and we had impossible feats considering the size and technology level of our country. However, I am always skeptical about all those teachings. History as told by only one side is never complete, and I want to know what “the other side” can tell me about the war.&lt;/p&gt;</description></item></channel></rss>