<?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>data-processing on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/data-processing/</link>
    <description>Recent content in data-processing on S Anand</description>
    <generator>Hugo -- 0.156.0</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 11 Aug 2015 13:14:40 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/data-processing/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Dissecting my Airtel bills</title>
      <link>https://www.s-anand.net/blog/dissecting-my-airtel-bills/</link>
      <pubDate>Tue, 11 Aug 2015 13:13:33 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/dissecting-my-airtel-bills/</guid>
      <description>&lt;p&gt;My monthly postpaid mobile bills have been in the Rs 2,000 – Rs 3,000 range for some time now, and I spent a few hours dissecting them yesterday.&lt;/p&gt;
&lt;p&gt;Page 3 had the good stuff. It’s a little hard to figure out, but what the last 2 columns say is that &lt;strong&gt;most of my spend is offset by discounts&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/2015-08-11-18_26_53-Start1.webp&#34;&gt;&lt;img alt=&#34;2015-08-11 18_26_53-Start&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/2015-08-11-18_26_53-Start1.webp&#34; title=&#34;2015-08-11 18_26_53-Start&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What’s &lt;strong&gt;not&lt;/strong&gt; getting offset are outgoing roaming calls. Followed by calls to local landlines. For all practical purposes, that’s the only thing that counts in this bill. Everything else is close enough to zero.&lt;/p&gt;
&lt;p&gt;It took me some time to figure out that Airtel postpaid has something called &lt;a href=&#34;http://www.airtel.in/mobile/postpaid/tariffs/myop-monthly-plan-active?region=4&#34;&gt;myPlan&lt;/a&gt;. Based on your plan, you get set of “myPacks” or discounts. That determines your final bill. And it turns out that I was barely using my quota in some areas – specifically data. I had 3GB of data available. I was typically using 200MB – 500MB. The last 2 columns on page 2 show the usage of myPacks.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/image5.webp&#34;&gt;&lt;img alt=&#34;image&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/image5.webp&#34; title=&#34;image&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Clearly, I can do with less data, less SMS, less local mobile, and perhaps less STD mobile. I might need more outgoing roaming, but that’s about it. This means I need fewer myPacks. So I was able to switch to the Rs 799 plan from the Rs 999 plan, while simultaneously increasing the number of free outgoing roaming calls I can make.&lt;/p&gt;
&lt;p&gt;There seems to be no myPack for incoming roaming, so I’m actually better off calling people if I’m travelling, rather than receiving calls!&lt;/p&gt;
&lt;p&gt;The rest of the bill is a treasure-trove of data, listing every call and every pulse of data connection. I only wish it also had the location of the calls, and were available as CSV files.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ashish&lt;/strong&gt; &lt;em&gt;11 Aug 2015 6:31 pm&lt;/em&gt;:
Ask Airtel to start 99/- per month national roaming pack to make all incoming roaming calls free.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;408wij&lt;/strong&gt; &lt;em&gt;11 Aug 2015 9:29 pm&lt;/em&gt;:
A quick google search turned up two android apps: (1) Call Log Location and (2) Log Call Location. Perhaps their logs can be exported and cross-referenced w/ your bill.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bala&lt;/strong&gt; &lt;em&gt;1 Sep 2015 12:47 pm&lt;/em&gt;:
You spend 1 day (&amp;gt;24 hours) in talking on your mobile.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&#34;http://www.faceofit.com/reviews&#34;&gt;Indrajit Ghosh&lt;/a&gt;&lt;/strong&gt; &lt;em&gt;18 Jan 2017 1:57 pm&lt;/em&gt;:
You can ask for a better Data deal from Airtel.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Restartable and Parallel</title>
      <link>https://www.s-anand.net/blog/restartable-and-parallel/</link>
      <pubDate>Thu, 30 Aug 2012 14:38:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/restartable-and-parallel/</guid>
      <description>&lt;p&gt;When processing data at a large scale, there are two characteristics that make a huge difference to my life.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Restartability&lt;/strong&gt;. When something goes wrong, being able to continue from where it stopped. In my opinion, this is more important than parallelism. There’s nothing as depressing as having to start from scratch every time. Think of it as the ability to save a game as opposed to starting from Level 1 in every life.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Parallelism&lt;/strong&gt;. Being able to run multiple processes in parallel. Often, this is easy. You don’t need threads. Good old UNIX &lt;a href=&#34;http://en.wikipedia.org/wiki/Xargs&#34;&gt;xargs&lt;/a&gt; can do a great job of it. Interestingly, I’ve never used Hadoop for any real-life problem. I’ve gotten by with UNIX commands and smart partitioning.&lt;/p&gt;
&lt;p&gt;The “smart partitioning” bit is important. For example, if you’re dealing with telecom data, you’d be calculating most of your metrics (e.g. did the number of calls grow or fall, are there more outgoing or incoming calls, etc.) are calculated on a single mobile number. So if you have multiple data sets, as long as all the data related to one mobile number are on the same system, you’re fine. If you have 100 machines, just split the data based on the last 2 digits of the mobile number. So data about 9012345678 would go to machine 78 (the last two digits). Given a mobile number for any type of data, you’d know exactly which machine would have that data. For all practical purposes, that gives you the basics of a distributed file system.&lt;/p&gt;
&lt;p&gt;(I’m not saying you don’t need Hadoop. Just that I haven’t needed it.)&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;kamaal&lt;/strong&gt; &lt;em&gt;30 Aug 2012 4:04 pm&lt;/em&gt;:
Anand,
If you were to write down- What would be the must learn skills for a data scientist?
I&amp;rsquo;ve sort been trying and working hard on this thing. Of course you must know programming, what else apart from a programmers ordinary skills set does a data scientist need.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Karthik Joshi&lt;/strong&gt; &lt;em&gt;3 Sep 2012 9:06 am&lt;/em&gt;:
I am a reader of your blogs. I love your visualization ideas. This one blog about distribution of work is a great Idea. But I think, it would depend on the nature of data for effective utilization of all 100 machines. (Suppose we have few numbers which will not end with 09 or 88 ro so on) How about hashing? Even though the distributedness of hash algorithm is a debatable issue, do you think this would be beneficial ? Just a thought.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
    <item>
      <title>Faster data crunching</title>
      <link>https://www.s-anand.net/blog/faster-data-crunching/</link>
      <pubDate>Fri, 23 Sep 2011 18:20:10 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/faster-data-crunching/</guid>
      <description>&lt;p&gt;I’ve been playing with big data lately.&lt;/p&gt; &lt;p&gt;The good part is, it’s easy to get interesting results. The data is so unwieldy that even average value calculations provoke a “Amazing! I didn’t know that,” response (No exaggeration. I heard this from two separate ~ $1bn businesses this month.)&lt;/p&gt; &lt;p&gt;The bad part is that calculating even that simple average is slow.&lt;/p&gt; &lt;p&gt;For example, take this &lt;a href=&#34;https://files.s-anand.net/blog/a/school_10.rpt.bz2&#34;&gt;40MB file&lt;/a&gt; (380MB unzipped) and extract the first column.&lt;/p&gt; &lt;p&gt;The simplest Python script to get the first column looks like this:&lt;/p&gt;
```python
for row in csv.reader(fileinput.input(), delimiter=&#39;\t&#39;):
    if len(row) &gt; 0: print row[0]
```
&lt;p&gt;That took a good 3 minutes to execute on my laptop.&lt;/p&gt;
&lt;p&gt;Since I’m used to &lt;a href=&#34;http://en.wikibooks.org/wiki/Ad_Hoc_Data_Analysis_From_The_Unix_Command_Line&#34;&gt;UNIX data processing&lt;/a&gt;, I tried &lt;code&gt;cut -f1&lt;/code&gt;. Weirdly, that’s worse. 5 minutes. Paradoxically, &lt;/code&gt;awk &#39;{print $1}&#39;&lt;/code&gt; only takes 17 seconds. That&#39;s about 12 times faster. Clearly the tool makes a big difference. And we always knew &lt;a href=&#34;http://swtch.com/~rsc/regexp/regexp1.html&#34;&gt;UNIX&lt;/a&gt; was &lt;a href=&#34;http://lists.freebsd.org/pipermail/freebsd-current/2010-August/019310.html&#34;&gt;fast&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But I also ran these on an &lt;a href=&#34;http://aws.amazon.com/ec2/&#34;&gt;Amazon EC2&lt;/a&gt; server, and a &lt;a href=&#34;http://www.hostgator.com/&#34;&gt;Hostgator&lt;/a&gt; server. Here’re the results.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;python&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;cut&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;awk&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&#34;http://www.dell.com/us/business/p/latitude-e5400/pd&#34;&gt;My Dell E5400&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;3:04 (&lt;b&gt;1x&lt;/b&gt;)&lt;/td&gt;
&lt;td&gt;5:42 (&lt;b&gt;0.5x&lt;/b&gt;)&lt;/td&gt;
&lt;td&gt;0:17 (&lt;b&gt;11x&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&#34;http://aws.amazon.com/ec2/#instance&#34;&gt;EC2 standard&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;0:33 (&lt;b&gt;6x&lt;/b&gt;)&lt;/td&gt;
&lt;td&gt;0:5.6 (&lt;b&gt;33x&lt;/b&gt;)&lt;/td&gt;
&lt;td&gt;0:16 (&lt;b&gt;11x&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&#34;http://support.hostgator.com/articles/hosting-plans/server-specifications-specs&#34;&gt;Hostgator&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;0:19 (&lt;b&gt;10x&lt;/b&gt;)&lt;/td&gt;
&lt;td&gt;0:2.5 (&lt;b&gt;74x&lt;/b&gt;)&lt;/td&gt;
&lt;td&gt;0:0.7 (&lt;b&gt;265x&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;What took 3 minutes with Python my Dell E5400 took &lt;em&gt;less than a second&lt;/em&gt; on Hostgator’s server with awk. Over &lt;em&gt;250 times&lt;/em&gt; faster. (Not 250%. 250 &lt;em&gt;times&lt;/em&gt;). &lt;/p&gt;
&lt;p&gt;And it’s not just hardware. A good tool (awk) made things 11x faster on my machine. Good hardware (hostgator) made the same program 10x faster. But choosing the right combination can make things go faster than 11 x 10 = 110 times. Much faster.&lt;/p&gt;
&lt;p&gt;There are a few of things I’m taking away from this.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Good hardware can speed you up much as (or more than) choosing the right tool.&lt;/li&gt;
&lt;li&gt;Good hardware can be rented. From many places. Cheaply.&lt;/li&gt;
&lt;li&gt;Always test what’s fast. awk’s fastest on my machine and Hostgator, but not on EC2.&lt;/li&gt;&lt;/ol&gt;
</description>
    </item>
    <item>
      <title>Python vs Perl</title>
      <link>https://www.s-anand.net/blog/python-vs-perl/</link>
      <pubDate>Wed, 11 Jan 2006 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/python-vs-perl/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://www.developertutorials.com/tutorials/python/python-perl-050423/page1.html&#34;&gt;Python vs Perl&lt;/a&gt;. Sums up my feelings perfectly: Python may be better for larger projects, but for my meddling, I&amp;rsquo;ll stick to Perl. It&amp;rsquo;s served me well for 10 years.&lt;/p&gt;
&lt;p&gt;Until 1999, I used Perl a fair bit, but no more than Java or C or anything else. My first &amp;ldquo;real-life&amp;rdquo; use of Perl was in 2000, when I was processing 600MB of IBES data. Access and SPSS couldn&amp;rsquo;t handle the load. Perl slurped all the data in a few seconds, though. A few years later, when processing bank data (3GB worth, this time), Perl again was the only saviour. In fact, between Excel and Perl (and &lt;a href=&#34;http://www.cpan.org/&#34;&gt;CPAN&lt;/a&gt;), I think I have all the data analysis power I&amp;rsquo;ve ever needed. This blog, for instance, is written in an Excel spreadsheet, exported to XML, and converted into the blog format by Perl.&lt;/p&gt;
</description>
    </item>
    <item>
      <title>DNA computer</title>
      <link>https://www.s-anand.net/blog/dna-computer/</link>
      <pubDate>Tue, 19 Mar 2002 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/dna-computer/</guid>
      <description>&lt;p&gt;This &lt;a href=&#34;http://physicsweb.org/article/news/6/3/11&#34;&gt;DNA computer&lt;/a&gt; seems to have done some good work.&lt;/p&gt;
</description>
    </item>
  </channel>
</rss>
