<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ambreen H. on Medium]]></title>
        <description><![CDATA[Stories by Ambreen H. on Medium]]></description>
        <link>https://medium.com/@ambreen2006?source=rss-a5b3e93ed78c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*auZnLFhAmwCsAK8ClYweEg.jpeg</url>
            <title>Stories by Ambreen H. on Medium</title>
            <link>https://medium.com/@ambreen2006?source=rss-a5b3e93ed78c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 04:01:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ambreen2006/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What’s the Journey of a Single Line of Compiled Code Like?]]></title>
            <link>https://medium.com/better-programming/journey-of-a-line-of-complied-code-b37c4a8deb0?source=rss-a5b3e93ed78c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b37c4a8deb0</guid>
            <category><![CDATA[c]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Ambreen H.]]></dc:creator>
            <pubDate>Mon, 01 Feb 2021 21:23:11 GMT</pubDate>
            <atom:updated>2021-02-04T19:44:38.226Z</atom:updated>
            <content:encoded><![CDATA[<h4>A look at the complete process of transforming a source code into an executable format</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fzTrAiwRR7_acDUW" /><figcaption>Photo by <a href="https://unsplash.com/@maxboettinger?utm_source=medium&amp;utm_medium=referral">Max Böttinger</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>At a high level, I’ll be looking at the output of each stage of compiling a simple C++ program using Clang. I’ll also follow our simple code in the disassembly output a little more closely and discuss parts of an ELF file.</p><p>When you fully compile your program, it produces an executable binary. For example, this simple program…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/87ccbfb60a3efda52388cc39ad2144b6/href">https://medium.com/media/87ccbfb60a3efda52388cc39ad2144b6/href</a></iframe><p>…produces binary code. Something like this (as viewed in a hex editor):</p><figure><img alt="Executable binary" src="https://cdn-images-1.medium.com/max/716/0*qPzgRyNjvsFZWX45" /><figcaption>Executable binary</figcaption></figure><p>If you run this program, the output is as expected:</p><pre>What’s Up?<br>20</pre><p>At this point, all of your code and data are transformed into binary in an appropriate format that your computer can execute. It’s not that comprehensible for us, but to get a better appreciation, you can change the static string part of this program to output something different when executed.</p><p>For example, in this binary, I changed the code 5768 6174 2773 2055 703f 000a representing the string What’s Up? to 576f 6e64 6572 6675 6c21 000a, and running that modified binary would produce the output:</p><pre>Wonderful!<br>20</pre><p>Yes! Wonderful, isn’t it?</p><p>I don’t know — should I be worried? This was just swapping some ASCII code around. Changing behavior will be a lot more difficult, so there’s probably nothing to worry about.</p><p>Regardless, we were talking about the process involved in taking a source file and compiling it into a binary. I’ll keep it high-level, though.</p><p>There are several stages that take place when transforming the source code into an executable format. You can see from the Clang documentation that the steps involved are namely:</p><pre>1. <a href="#4f9b">Pre-Processing</a><br>2. <a href="#ad85">Parsing and Semantic Analysis</a><br>3. <a href="#0b95">Code Generation and Optimization</a><br>4. <a href="#3f63">Assembly</a><br>5. <a href="#b8ff">Linking</a></pre><figure><img alt="Stages of compilation" src="https://cdn-images-1.medium.com/max/1024/1*d6nMqE8npeg9LhCzQ0Efow.png" /><figcaption>Stages of compilation</figcaption></figure><p>Let’s look at the output of each of the above stages.</p><h3>Pre-Processing</h3><p>Clang documentation describes this as:</p><blockquote>“This stage handles tokenization of the input source file, macro expansion, #include expansion and handling of other preprocessor directives.”</blockquote><p>The output for our program at the end of this stage shows that the macros are expanded. Notice that we have std::cout &lt;&lt; “What’s Up?” &lt;&lt; “\n”;, while the original code was std::cout &lt;&lt; MSG &lt;&lt; “\n”;.</p><pre>…..</pre><pre>namespace std __attribute__ ((__visibility__ (“default”)))</pre><pre>{</pre><pre># 60 “/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/iostream” 3</pre><pre>extern istream cin;<br>extern ostream cout;<br>extern ostream cerr;<br>extern ostream clog;<br>extern wistream wcin;<br>extern wostream wcout;<br>extern wostream wcerr;<br>extern wostream wclog;<br>static ios_base::Init __ioinit;<br>}</pre><pre># 2 “pass_by_reference_example.cpp” 2</pre><pre>void addTen(int&amp; num) {</pre><pre>num += num + 10;</pre><pre>}</pre><pre>int main(int argc, const char* argv[]) {</pre><pre>int a_something = 5;</pre><pre>std::cout &lt;&lt; “What’s Up?” &lt;&lt; “\n”;</pre><pre>addTen(a_something);</pre><pre>std::cout &lt;&lt; a_something &lt;&lt; “\n”;</pre><pre>return 0;</pre><pre>}<br>…</pre><p><strong>Note: </strong>I had to clip a lot of lines of the top. It was C++ template stuff.</p><h3>Parsing and Semantic Analysis</h3><p>Clang documentation describes this as:</p><blockquote>“This stage parses the input file, translating preprocessor tokens into a parse tree. Once in the form of a parse tree, it applies semantic analysis to compute types for expressions as well and determine whether the code is well formed. This stage is responsible for generating most of the compiler warnings as well as parse errors. The output of this stage is an ‘Abstract Syntax Tree’ (AST).”</blockquote><p>This stage produced an AST. You can see how a variable such as a_something is represented in a hierarchy. So is the rest of our code. Again, I clipped a lot of lines so the output would stay within the realm of the familiar and simple.</p><figure><img alt="AST" src="https://cdn-images-1.medium.com/max/1024/0*hF-_4OX9rBQCBW6E" /><figcaption>AST</figcaption></figure><h3>Code Generation and Optimization</h3><p>Clang documentation describes this as:</p><blockquote>“This stage translates an AST into low-level intermediate code (known as ‘LLVM IR’) and ultimately to machine code. This phase is responsible for optimizing the generated code and handling target-specific code generation. The output of this stage is typically called a ‘.s’ file or ‘assembly’ file.”</blockquote><p>This stage eventually produces target-specific assembly code. I’m inserting a screenshot of the output, but, later in the article, we can walk through the assembly code from the objdump as it interleaves the code with assembly. That’s where we’ll follow some of the code we wrote.</p><figure><img alt="Assembly output" src="https://cdn-images-1.medium.com/max/1007/0*W_c7l89zLRggsCCH" /><figcaption>Assembly output</figcaption></figure><h3>Assembly</h3><p>Clang documentation describes this as:</p><blockquote>“This stage runs the target assembler to translate the output of the compiler into a target object file. The output of this stage is typically called a ‘.o’ file or ‘object’ file.”</blockquote><p>Assembler produces an object file. Our platform is Ubuntu — therefore, the type of the object file produced for this platform is ELF. Specifically, it’s:</p><pre>ELF 64-bit LSB relocatable, x86–64, version 1 (SYSV), with debug_info, not stripped</pre><p>This is a relocatable file, and hence not all memory addresses are resolved. The screenshot below is the header information of the ELF file:</p><figure><img alt="ELF header of object file" src="https://cdn-images-1.medium.com/max/679/0*CKKmnM3CYBzasPPK" /><figcaption>ELF header of object file</figcaption></figure><p>As you can see above, Entry point address is 0x0 because it’s not an executable yet and doesn’t know the entry point of its virtual address space.</p><h3>Linker</h3><p>Clang documentation describes this as:</p><blockquote>“This stage runs the target linker to merge multiple object files into an executable or dynamic library. The output of this stage is typically called an ‘a.out,’ ‘.dylib’ or ‘.so’ file.”</blockquote><p>Finally, the linker takes the object file(s) and creates an executable, resolving the resolvable addresses.</p><p>ELF binary consists of an executable header, zero or more program headers, and zero or more sections headers. Let’s take a brief look at the components.</p><h4>Executable header</h4><p>The screenshot below shows the ELF header output of our executable. It gives us information about the kind of file it is, where to find other contents in the file, etc.</p><p>The Magic field is a 16-byte array that has a 4-byte magic value, indicating this is an ELF file.</p><figure><img alt="ELF header of executable file" src="https://cdn-images-1.medium.com/max/678/0*SJyLBZgVXi-gc__I" /><figcaption>ELF header of executable file</figcaption></figure><p>As you can see now from the above headers output, it now has an entry point: 0x4010d0<strong>, </strong>the virtual memory address from where the execution should start. Its type is executable.</p><h4>Sections</h4><p>Sections organize data and code logically. They provide an organized view for the linker. Let’s explore the sections present in our binary using readelf.</p><figure><img alt="Sections" src="https://cdn-images-1.medium.com/max/910/0*Fvm-6SdvrYMOmp5j" /><figcaption>Sections</figcaption></figure><p>I think we can look at some of the more well-known sections:</p><p><strong>.text</strong></p><p>.text contains the main executable code. There’s a lot of output, so I’ll just show screenshots of the few that we can recognize. Let’s start with the entry point address that we found in our ELF header. Here’s the disassembly for that:</p><figure><img alt="Start method" src="https://cdn-images-1.medium.com/max/1024/0*pBzg7krBwP1qyXL8" /><figcaption>Start method</figcaption></figure><p>So this isn’t really our main function — this is some _start, probably setting up and/or initializing the program.</p><p>The register rdi is for passing the first argument, and this is the address of our main function, as depicted in the screenshot below.</p><pre>4010f1: 48 c7 c7 e0 11 40 00 mov rdi,0x4011e0</pre><figure><img alt="Disassembly of main method" src="https://cdn-images-1.medium.com/max/1024/0*WDMqcMQ74vsAQxOc" /><figcaption>Disassembly of main method</figcaption></figure><p>We can see here that a_something gets created at [rbp-0x14], and it’s value is set to 0x5.</p><pre>int a_something = 5;</pre><pre>4011f6: c7 45 ec 05 00 00 00 mov DWORD PTR [rbp-0x14],0x5</pre><p>In our code, we call addTen and pass the reference of <strong>a_something</strong> to it. The disassembly for it is:</p><pre>addTen(a_something);</pre><pre>401228: 48 8d 7d ec    lea rdi,[rbp-0x14]<br>40122c: 48 89 45 e0    mov QWORD PTR [rbp-0x20],rax<br>401230: e8 8b ff ff ff call 4011c0 &lt;_Z6addTenRi&gt;</pre><p>Not sure what the line 40122c is accomplishing by moving the temp rax to [rbp-0x20], but we know lea is loading the effective address at [rbp-0x14] — i.e., the address of a_something into rdi, which is used for passing the first argument and making a call to the addTen method:</p><figure><img alt="Disassembly of addTen method" src="https://cdn-images-1.medium.com/max/720/0*kGg7o1JduajQ5i5H" /><figcaption>Disassembly of addTen method</figcaption></figure><p>There’s pointer bookkeeping going on here: rbp is the base pointer, and rsp is the stack pointer always pointing to the top of the stack.</p><pre>4011c0: 55       push rbp<br>4011c1: 48 89 e5 mov rbp,rsp</pre><p>rdi holds the address of a_something. That address is now copied to [rbp-0x8] and then further copied to the rax register.</p><pre>4011c4: 48 89 7d f8 mov QWORD PTR [rbp-0x8],rdi<br>4011c8: 48 8b 45 f8 mov rax,QWORD PTR [rbp-0x8]</pre><p>Now the content at the address of a_something is copied to the ecx register.</p><pre>4011cc: 8b 08 mov ecx,DWORD PTR [rax]</pre><p>0xa is 10 in decimal, and it’s being added to the content of ecx, which holds the value of a_something.</p><pre>4011ce: 83 c1 0a add ecx,0xa</pre><p>Now the result is being placed at the address in the rax register:</p><pre>4011d7: 89 08 mov DWORD PTR [rax],ecx</pre><p>It’s interesting that the assembly from the Clang output had a msg macro expanded, but the objdump assembly output kept it intact.</p><p><strong>.rodata</strong></p><p>This section contains read-only data. So, for us, it has our msg string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/0*w4cmzuTvzBLyfoVD" /><figcaption>.rodata</figcaption></figure><p><strong>.bss</strong></p><p>This holds uninitialized data.</p><h4>Segments</h4><p>Segments provide information used by the operating system and the dynamic linker to set up and load the process for execution. This is what it looks like for our process:</p><figure><img alt="Segments" src="https://cdn-images-1.medium.com/max/1024/0*IjFlXlVw8iwB6kRM" /><figcaption>Segments</figcaption></figure><p>The LOAD types are the segments to be loaded in the memory. We can see the segment that contains our main code is in segment 03, consisting of the sections .init, .plt, .text, and .fini. It’s set to read (R) and execute (E).</p><p>Our .rodata is in segment 04 — .rodata, .eh_frame_hdr, .eh_frame — and it’s set to read (R).</p><h3>Conclusion</h3><p>And that’s it for now. Obviously, there are a lot of things to understand and go deeper with, but getting an overall view is also interesting in itself. If I get a chance, I’ll write about how this little process looks like in memory.</p><h3>References</h3><p><a href="https://clang.llvm.org/docs/CommandGuide/clang.html">Clang 12 documentation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b37c4a8deb0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/journey-of-a-line-of-complied-code-b37c4a8deb0">What’s the Journey of a Single Line of Compiled Code Like?</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Derangement Is the new normal]]></title>
            <link>https://medium.com/swlh/derangement-is-the-new-normal-cbec389608e9?source=rss-a5b3e93ed78c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbec389608e9</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[combinatorics]]></category>
            <category><![CDATA[permutations]]></category>
            <dc:creator><![CDATA[Ambreen H.]]></dc:creator>
            <pubDate>Sat, 31 Oct 2020 21:08:49 GMT</pubDate>
            <atom:updated>2020-11-11T05:53:19.487Z</atom:updated>
            <content:encoded><![CDATA[<h3>Derangement Is the New Normal (Combinatorics)</h3><p>No, not really, that would be an insane title but then that’s what this post is about. Actually, no, that’s not quite right. I recently read about a combinatorial problem of generating permutations such that no element is placed in its original position, and that’s what this post is about. Derangement is what such a permutation is called.</p><p>For example, let’s say in a peer reviewed course, an assignment is to be distributed to students then it makes sense that each student gets an assignment to review other than one’s own. Concretely, if there are three students named Napoleon, Snowball, and Squealer*, then a possible permutation would be that Napoleon review Snowball’s assignment, Snowball review Squealer’s, and Squealer review Napoleon’s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*n1lhiJDOExv6zOp6iGoFxQ.png" /><figcaption>Figure — 1</figcaption></figure><p><em>*Disclaimer: Yes, these are the pigs from Animal Farm** by Orwell and apologies for my drawing.</em></p><p><em>**Disclaimer on the Disclaimer: The names do not reflect any aspect of the story.</em></p><p>A possible derangement of the above assignments for peer reviewing would be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*usYUHudKAv48TXwouCpXSQ.png" /><figcaption>Figure — 2</figcaption></figure><p>But why am I writing about this? For myself mostly, as it helps to understand some concepts better when one writes about them.</p><p>Here, I will be discussing two aspects of derangement, the number of ways such arrangements can be made i.e. counting derangements, and how to generate such arrangements.</p><h3>Counting Derangements</h3><p>The total number of permutations possible for our 3 students reviewing 3 papers are 6 as depicted below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*OXMjDrrgm_USdlrmurIcsg.png" /><figcaption>Figure — 3</figcaption></figure><p>Only two of them are derangements because only two such arrangements result in a permutation where no student is reviewing it’s own assignment.</p><p>One way to find out how many derangements exist for any given number of items/elements is to use Inclusion-Exclusion Principle.</p><h4>Inclusion-Exclusion Principle</h4><p>Using this principle, we can count the number of derangements as follows:</p><p>Derangement count = All permutations -|<em>Napoleon reviewing its own </em>⋃ <em>Squealer reviewing its own</em> ⋃ <em>Snowball reviewing its own</em>|</p><p>All permutations are n!, so we can rewrite as:</p><p>Derangement count = 3! - |<em>Napoleon reviewing its own </em>⋃ <em>Squealer reviewing its own</em> ⋃ <em>Snowball reviewing its own</em>|</p><p><strong>*</strong>⋃<strong> </strong>means Union</p><p>As you can see in Figure-3 the number of arrangements such that each student is reviewing its own assignment is 2 for each of the three students. However, the first arrangement is counted multiple times while it should have been counted only once. So to count the union of all permutations that contains a student reviewing it’s own paper, we will adjust for the over counted.</p><p>|<em>Napoleon reviewing its own</em> U <em>Squealer reviewing its own</em> U <em>Snowball reviewing its own</em> | <strong>=</strong> |<em>Napoleon reviewing its own| + |Squealer reviewing its own|+ |Snowball reviewing its own| - </em>|<em>Napoleon reviewing its own </em><strong>⋂</strong><em> Squealer reviewing its own|- </em>|<em>Napoleon reviewing its own </em><strong>⋂</strong><em> Snowball reviewing its own|- </em>|<em>Squealer reviewing its own </em><strong>⋂</strong><em> Snowball reviewing its own| + </em>|<em>Squealer reviewing its own </em><strong>⋂</strong><em> Snowball reviewing its own </em><strong>⋂ </strong><em>Napoleon reviewing its own|</em></p><p>*⋂ means intersection</p><p>Even I cannot read what’s going on up there, so I’ll assign letters instead. Consider as follows:</p><p>A =&gt; <em>Napoleon reviewing its own</em></p><p>B =&gt; <em>Squealer reviewing its own</em></p><p>C =&gt; <em>Snowball reviewing its own</em></p><p>|A ⋃ B ⋃ C| = |A| + |B| + |C| - |A ⋂ B| - |A ⋂ C| - |B ⋂ C| + |A ⋂ B ⋂ C|</p><p>|A ⋃ B ⋃ C| = 2 + 2 + 2 - 1 -1 -1 + 1</p><p>|A ⋃ B ⋃ C| = 4</p><p>Now we can plug this value to get the derangement count.</p><p>Derangement count = 3! - |<em>Napoleon reviewing its own</em> <strong>U</strong> <em>Squealer reviewing its own</em> <strong>U</strong> <em>Snowball reviewing its own</em>|</p><p>Derangement count = 6-4</p><p>Derangement count = 2</p><p>This is all good but there is another intuitive approach available to us that counts the number of derangements using recursion.</p><h4>Count Derangements Using Recursion</h4><p>I must tell you that it took me a while to understand the intuitive approach. Fortunately, a book that I mostly used as a monitor stand delivered me out of my misery and got me past my mental block.</p><p>If there was only one student, let’s say Snowball, then how many ways can he review an assignment not of its own? That would be 0 ways. There is only one assignment written by Snowball, so there is no peer to review his assignment and no other assignment for him to review.</p><p>What if there were only two students, let’s say Snowball and Squealer? Then there will be only one possible derangement such that no student review it’s own assignment. Snowball reviews Squealer’s, and Squealer reviews Snowball’s.</p><p>So, we’ve established a base case for our recursion. If there are two students, then there is only one derangement possible and if there is only one student then there is no derangement possible.</p><p>For any number <strong>N</strong> higher than 2, you can think of it this way: One of the student takes an assignment to review from one of the other N-1 students. Let’s say Napoleon takes the assignment done by Squealer, then we can be assured that at least one of the students (Napoleon) is reviewing assignment other than its own. Now there are N-1 students left to be deranged.</p><p>Let’s add one more student, Old Major, to make it more interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iK_-33qiU1gTQF5p73A97w.png" /><figcaption>Figure — 4</figcaption></figure><p>Napoleon gets the assignment done by Squealer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lcHtUMfJxLzgYUK8uCRiPw.png" /><figcaption>Figure — 5</figcaption></figure><p>But what about Napoleon’s assignment? Should it be reviewed by Squealer? Yeah, but it’s not necessary, right? Maybe Snowball can review Napoleon’s paper, Squealer review Old Major’s and Old Major review Napoleon’s paper.</p><p>So, you see there are two ways this can play out, <strong>1</strong>: Napoleon takes Squealer’s paper and Squealer takes Napoleon’s,<strong> 2</strong>: Napoleon takes Squealer’s paper, and someone other than Squealer takes Napoleon’s paper.</p><p>In <strong>case 1</strong> when two students exchange their papers, we are left with N-2 students in need of derangement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7CdyxNHQxKBh2b83a9Ed7g.png" /><figcaption>Figure — 6</figcaption></figure><p>In <strong>case 2</strong>, we only know that Napoleon has Squealer’s assignment and we want Napoleon’s assignment get reviewed by someone other than Squealer. We can do so by first giving Squealer, Napoleon’s assignment and getting a derangement between Snowball, Old Major, and Squealer, that way Napoleon’s assignment will not be reviewed by Squealer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1gdyzR0g-n_vC0P6FG3vZQ.png" /><figcaption>Figure — 7</figcaption></figure><p>Now, we made an arbitrary decision to select Napoleon and Squealer but it could have been any of the other students. So this mean any of the N-1 students could have taken the place of Napoleon, therefore, this process needs to be repeated for the rest of the N-1.</p><p>Considering the above two cases, our recurrence relation can be stated as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*eYqR-T5H4zzl4uhx0Ncumw.png" /><figcaption>Recurrence Relation — 1</figcaption></figure><p>To code this, we don’t necessarily need to use recursion, as we are only ever needing to know two values D(N-2) and D(N-1) that we can keep track of inside a for loop but this is an exercise for getting practice in recursion, so I’ll use it anyways.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*coIfUeMK8GZcrghsrdi-wA.png" /><figcaption>Code Snippet — 1</figcaption></figure><p>I used lru_cache to optimize for overlapping subproblems. This way, I don’t need to compute again the values of n already worked out. Since I only care about the last two values, i.e. n-2 and n-1, I set the cache size to be 2. If I were to reuse it often for different values of n, then it would make sense to cache more results than just the last two.</p><p>Following shows the derangement counts reported by the above algorithm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BYahwcjQ33a-uD1COdKk3g.png" /><figcaption>Output — 1</figcaption></figure><p>You could also write the program to compute this number starting from 1 and going up to N without using recursion.</p><h3>Generating Derangement</h3><p>Now that the counting is out of the way, let’s have some fun generating derangement for our students.</p><p>I’m going to change something here though, instead of finding derangements on specific lists, I’ll find derangements on an array of a specific size, making it generic. That way, when I get all the derangements, I will use it as a template to generate derangement of the original list.</p><p>For example, I will treat the list<strong> [‘Snowball’, ‘Napoleon’, ‘Squealer’, ‘Old Major’] </strong>as <strong>[0, 1, 2, 3]</strong>.</p><p>Each index or position means the student, while the value it is holding means the assignment of the student.</p><p>Snowball is represented by index 0<br>Napoleon is represented by index 1<br>Squealer is represented by index 2<br>Old Major is represented by index 3</p><p>Now, if we get a derangement represented by this array: <strong>[2, 3, 1, 0]</strong>, it means that Snowball represented by 0th index is reviewing Squealer’s assignment because 2 represents Squealer. Consecutively, this derangement would translate into: <strong>[‘Squealer’, ‘Old Major’, ‘Napoleon’, ‘Snowball’]</strong>.</p><p>The algorithm below swaps the starter element with the last element of the list and recursively calls itself by incrementing the starter element index and thereby reducing the size of the problem by 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hfQc5c4TpFRqUiEgp_iFZQ.png" /><figcaption>Code Snippet — 2</figcaption></figure><p>`find_derangements_of_size` is a wrapper that accepts an integer indicating the number of elements for which the derangements are to be generated. In our case, that will be 4. Line 20 just create this list i.e. [0, 1, 2, 3]</p><p>`find_derangement_helper` is then called with initial value of k as 0. So, the loop on line 11 will consider all elements from index 3 (length of the list minus 1) to index 0. The index k is fixed at each level of the tree and its value is swapped with the element at index i which is the loop variable (line 15–16), provided if such a swap does not end up placing the element in its original position (line 12–13). Once the call returns, the original value of the k’th index is restored in line 17 and next i’th element is considered. When ‘k’ reaches the size of the elements list, a derangement is found and copied to d_list, line 7–9.</p><p>Line 28–29 uses the derangements on the generic list to create derangements on the original list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4JxkC4JEV8WURfrYPUUIDA.png" /></figure><p>Line 33 to 35 shows usage of the above class. The output of running the program is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwKDlFvsmj4Y-oQstMhmmQ.png" /><figcaption>Output — 2</figcaption></figure><h3>Last Words</h3><p>For lack of a better title. I’m not summarizing anything here. Just want to conclude. I may add few more things to the article later such as the recursion tree created by the 2nd code snippet. Please let me know if you find any mistakes.</p><h3>References</h3><ul><li>Where I first learnt about derangements:</li></ul><p><a href="https://www.udemy.com/course/dynamic-programming-python/">Dynamic Programming Python, Coding Interviews &amp; Applications</a></p><ul><li>The book I used as monitor stand that helped me understand one of the concept in the recurrence relation:</li></ul><p>Applied Combinatorics by Fred Roberts (Author), Barry Tesman (Author)</p><p><a href="https://amzn.to/3kGHNpk">https://amzn.to/3kGHNpk</a></p><ul><li>Guide to Competitive Programming by Antti Laaksonen <a href="https://link.springer.com/book/10.1007/978-3-319-72547-5">https://link.springer.com/book/10.1007/978-3-319-72547-5</a></li><li><a href="https://rosettacode.org/wiki/Permutations/Derangements">https://rosettacode.org/wiki/Permutations/Derangements</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbec389608e9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/derangement-is-the-new-normal-cbec389608e9">Derangement Is the new normal</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Merchandise Store]]></title>
            <link>https://ambreen2006.medium.com/merchandise-store-3aef4090ed1a?source=rss-a5b3e93ed78c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3aef4090ed1a</guid>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[google-analytics-360]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[udacity-nanodegree]]></category>
            <dc:creator><![CDATA[Ambreen H.]]></dc:creator>
            <pubDate>Mon, 18 May 2020 09:36:46 GMT</pubDate>
            <atom:updated>2020-05-18T09:36:46.426Z</atom:updated>
            <content:encoded><![CDATA[<p>Google Public Dataset provides an obfuscated dataset of its Merchandise Store. Some of the questions we can ask are:</p><ul><li>Where are the buyers from?</li><li>What kind of platform or technology the buyers are using?</li><li>Can we build a classification model to distinguish between a potential buyer or a window shopper?</li></ul><p>We will find out as we dive into the data that the traffic for most of the sessions comes from the browser Chrome, Windows Operating System, and the US.</p><p>Later, we will evaluate different classifiers to identify potential buyers.</p><h4>Merchandise Store</h4><p>The store (<a href="https://shop.googlemerchandisestore.com/">shop.googlemerchandisestore.com</a>) sells Google-branded merchandise. If you navigate to the store using the information page of ‘Google Analytics Sample’, the URL is extended by source traffic relation parameters, notice below, utm_source, medium, etc.</p><blockquote><a href="https://shop.googlemerchandisestore.com/?utm_source=Partners&amp;utm_medium=affiliate&amp;utm_campaign=Data%20Share%20Promo">‘https://shop.googlemerchandisestore.com/?utm_source=Partners&amp;utm_medium=affiliate&amp;utm_campaign=Data%20Share%20Promo</a>’</blockquote><p>This I believe corresponds to one of the fields in the dataset of interest.</p><p>As you are browsing through, you would see different kinds of products: jackets, pens, water bottles, etc, all, well of-course Google-branded. So, it is quite plausible that the buyers are a narrow niche. I could think of few e.g. employees, purchasers for internal events. I generally buy such branded stuff when I’m attending an event like Google I/O.</p><h4>Data Source</h4><p>As mentioned above, the dataset is from Google Public Dataset and contains obfuscated 12-month records from 2016 to 2017. For this project, I executed a few big queries in the jupyter notebook and downloaded the data of interest in CSV files.</p><p><a href="https://cloud.google.com/public-datasets">Public Datasets | Google Cloud</a></p><h4>Data Exploration</h4><p>Each <strong>row</strong> in the dataset relates to an analytics 360 session. Some of the fields we will be using and may need an explanation from the schema are:</p><blockquote><strong><em>transactions</em></strong><em> : Total number of ecommerce transactions within the session.</em></blockquote><blockquote><strong><em>fullVisitorId</em></strong><em>: The unique visitor ID (also known as client ID)</em></blockquote><blockquote><strong><em>date</em></strong><em>: The date of the session in YYYYMMDD format.</em></blockquote><blockquote><strong><em>timeOnSite</em></strong><em>: Total time of the session expressed in seconds.</em></blockquote><blockquote><strong><em>visits</em></strong><em>: The number of sessions (for convenience). This value is 1 for sessions with interaction events. The value is null if there are no interaction events in the session.</em></blockquote><blockquote><strong><em>medium</em></strong><em>: The medium of the traffic source. Could be “organic”, “cpc”, “referral”, or the value of the utm_medium URL parameter</em></blockquote><blockquote><strong><em>sessionQualityDim: </em></strong><em>An estimate of how close a particular session was to transacting, ranging from 1 to 100, calculated for each session. A value closer to 1 indicates a low session quality, or far from transacting, while a value closer to 100 indicates a high session quality, or very close to transacting. A value of 0 indicates that Session Quality is not calculated for the selected time range.</em></blockquote><p>The graph below shows the sum of the number of transactions grouped by year and month. Dec 2016 has the highest number of transactions, perhaps due to the Christmas holidays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*6n04zHiv1ROE2FHmkuMUAw.png" /></figure><p><strong>What is the proportion of visitors making transactions?</strong></p><blockquote><em>Total visitors = 714167<br>Visitors with transactions sum greater than zero = 10022<br>Percentage of visitor making a transaction = 0.01</em></blockquote><h4>Where are the buyers from?</h4><p>The graph below shows the continents, countries, cities, regions, and metro, sorted based on the highest total e-commerce transactions.</p><p>As you can see, for this dataset, the continent is the Americas, and the country is the US. Some of the graphs are showing ‘not available in dataset’, perhaps those are obfuscated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dk6dKiJt30mY59y9E5rdsg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*QQk2xmi1LlRkiyngvOgbVw.png" /></figure><p>The <strong>average transactions </strong>across these features are below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADq9xNLD780Qu8I4rJ6n0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*pjvmW1x9Sl7IGuZ_kHSF_w.png" /></figure><p>The above two groups of graphs show different rankings, Anguilla is an outlier though as there has only been one session originated from that location.</p><p>However, let’s compare Atwater with New York. The number of transactions over total sessions from Atwater is higher than NY albeit the absolute numbers being small.</p><blockquote><strong><em>Atwater</em></strong><em>, total sessions = 8<br>sessions with total transactions &gt; 0 = 2<br>percentage = 0.25</em></blockquote><blockquote><strong><em>New York</em></strong><em>, total sessions = 26371<br>sessions with total transactions &gt; 0 = 1507<br>percentage = 0.05714610746653521</em></blockquote><h4>What are the browser platforms used by visitors?</h4><p>There are about 54 unique browsers with sessions in these 12 months but only a few are generating higher session traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*kPFQ3sXpLf3oEXGtA7Q_ow.png" /></figure><p>Graph for the top 10 browsers are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*Ne_yBdvgwpVWw36vpUgSKg.png" /></figure><p>Most of the traffic is from Chrome.</p><h4>What are the operating systems that visitors are using?</h4><p>There are about twenty unique Operating Systems amongst all the sessions. Windows seems to have the highest session counts followed by Macs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*QwOo_KyVGVy5xE_1TLUnew.png" /></figure><h4>What are the traffic sources?</h4><p>There are about <strong>274</strong> unique sources, some of which includes: google, baidu, (direct), phandroid.com…</p><p>But the graph for the top 50 as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*LfyrCMlnhrXJT_wtKbPuQA.png" /></figure><h4>What are the mediums of the traffic source?</h4><p>Medium is the general category of the source traffic, e.g. ‘cpc (cost per click)’, ‘direct’, ‘referral’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*dRP6IX1NZC_vP8fPbJq3zQ.png" /></figure><p>Some of the mediums for Google Analytics are defined as follows:</p><ul><li>organic: unpaid search</li><li>cpc: cost per click, i.e. paid search</li><li>cpm: cost per thousand impressions</li><li>referral: a web referral</li><li>none: direct traffic has a medium of ‘none’</li></ul><p>Most of the sessions were direct traffic followed by referral and organic.</p><h4>Classifying visitors as buyers</h4><p>Each row in the data corresponds to a session but we are interested in classifying the visitors. To achieve this, the sessions are grouped by fullVisitorId and aggregated on selected features and a new data frame for visitors is created.</p><p>The features selected are timeOnSite, visits, medium, country, browser, transactions, and sessionQualityDim.</p><p>The categorical features <strong>country</strong> and <strong>browser</strong> have a large number of values. To prevent the feature set from exploding, the low-frequency values with respect to transactions are collapsed into ‘Other’. These are then further transformed into dummy variables along with the <strong>medium</strong>.</p><p>‘<strong>transaction</strong>’ is further translated by clipping values higher than one to 1. The data frame is normalized afterward.</p><p>The dataset we have is unbalanced as stated earlier, a very small proportion of visitors are buyers, therefore, undersampling is needed for the models to fit properly.</p><p>The graph below shows the scores of different models in classifying the visitor’s data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*IJEzkWVsMUMi77F5IzncBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*48zFAL6gnj0mYLkacMSIWw.png" /></figure><p>Except for the GaussianNB, all the other models appear to be close to each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*qszmHOmWwpaQAUZ8oGXlQw.png" /><figcaption>Confision Matrix for AdaBoostClassifier</figcaption></figure><p>The graph on the left is the confusion matrix for AdaBoostClassifier.</p><p>In this model, I believe, higher recall is more important because we would not want to waste the opportunity to focus marketing efforts on potential buyers. And visitors misidentified as buyers would be less harmful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3aef4090ed1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When we try to pick out anything by itself, we find it hitched to everything else in the universe.]]></title>
            <link>https://ambreen2006.medium.com/when-we-try-to-pick-out-anything-by-itself-we-find-it-hitched-to-everything-else-in-the-universe-4b0cefb8603c?source=rss-a5b3e93ed78c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b0cefb8603c</guid>
            <category><![CDATA[global-warming]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[udacity]]></category>
            <dc:creator><![CDATA[Ambreen H.]]></dc:creator>
            <pubDate>Mon, 18 May 2020 09:30:46 GMT</pubDate>
            <atom:updated>2020-05-26T20:14:21.445Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Global Temperature Trend</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lhMERq2lwpdeI-q8cNggaQ.png" /><figcaption>Modified Image from <a href="https://www.nasa.gov/topics/earth/images/index.html">NASA</a></figcaption></figure><blockquote>When we try to pick out anything by itself, we find it hitched to everything else in the universe. (John Muir)</blockquote><p>Searing bright flames leaped and engulfed the majestic oak and pine trees, along with anything that was caught in its way, that wildfire, the California Campfire, was one of the most destructive in California’s history of wildfires. Even if you were a few hundred miles away, somewhere in the bay area, you could feel the smoke-filled air scorching your throat and constricting the airways as you inhale.</p><p>Although many different factors lead to the back to back wildfires, climate change also has its role to play. But California is no stranger to wildfires then what gives? California’s temperature is on an upward trajectory, which helps enable longer and more intense fire seasons, creates more fuel to burn as vegetation and grasses dry out, these flames are then further carried out at the backs of strong winds, spreading the fires over large areas.</p><p>Another incident that grabbed my attention while reading about this subject happened several years earlier, in 2015, and in a different continent, the temperature rose to ~120 degrees Fahrenheit in Pakistan and India, resulting in the loss of thousands of lives. The heatwaves were expected but the intensity and the frequency of such events relate it to the global climate change.</p><p>Here, I will be giving an elementary treatment to the global temperature, visualizing the historic trend, and evaluating its relationship with other aspects of the environment.</p><p>With the help of scikit&#39;s LinearRegression, we will work out that:</p><ul><li>The average rate of increase in global temperature per decade after 1981 is much higher then what it is since 1880 per decade.</li><li>Greenhouse gases play a significant role in the increase in temperature.</li><li>Stratospheric Aerosols have a cooling effect.</li><li>Visualize other variables such as El Niño, La Niña, and Total Solar Irradiance on the timeline.</li><li>Create a regression model that includes other climate variables to understand their relationship with the global temperature.</li></ul><h4>Global Temperature</h4><p>Following is the plot of <a href="https://data.giss.nasa.gov/gistemp/">GISTEMP</a> showing the actual as well as a rolling average over 10 years periods. GISS Surface Temperature Analysis (GISTEMP) gives us an estimate of the global surface temperature change. <a href="https://data.giss.nasa.gov/gistemp/faq/#q201">It recalculates consistent temperature anomaly series from 1880 to the present.</a> Temperature anomaly is the temperature deviation from the base period which in this case is <a href="https://data.giss.nasa.gov/gistemp/faq/#q101">average over the 30 years from 1951 to 1980</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*AazPZ78STDrb-ElCm-SV0g.png" /></figure><p>A few inferences can be made prima facie, looking at the graphs above, the global temperature anomaly is increasing year by year.</p><p>We can model this in the following equation:</p><blockquote><strong><em>Global Temperature = 0.0074 * Year + -14.44</em></strong></blockquote><blockquote><strong><em>Explained variance = 0.74</em></strong></blockquote><p>Let’s see how the residuals look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*dkGtir8SvRGWA_54RkSIxw.png" /><figcaption>Residuals from Model 1</figcaption></figure><p>As you can see above the residuals graph are not as random and has some shape like that of W.</p><p>Plotting again the trend below, you can see the line before 1981 has more ups and downs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gyvN8NXqmFuxtOpbR9KEiw.png" /></figure><p>Therefore, I’m going to divide the timeline into before and after 1981. The following graphs show the residuals for the two divided timelines:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*dxDEjPILLmQplfcRE6BOPg.png" /><figcaption>Before 1981 on the left, After 1981 on the right</figcaption></figure><p>The explained variance for the above two graphs are:</p><blockquote><strong><em>Before 1981 Explained Variance = 0.4282</em></strong></blockquote><blockquote><strong><em>After 1981 Explained Variance = 0.848859</em></strong></blockquote><p>The explained variance for the timeline after 1981 is higher compared to both before 1981 and the full time-series.</p><p>The above two timelines can be modeled as follows:</p><blockquote><strong><em>After 1981 Global Temperature = 0.0194 * Year — 38.320418</em></strong></blockquote><blockquote><strong><em>Before 1981 Global Temperature = 0.0037* Year — 7.340883</em></strong></blockquote><p><strong>The rate of change of the global temperature after 1981 is 0.1942 degrees centigrade per decade</strong>. This approximately matches with the statement at ‘<a href="https://www.climate.gov/news-features/understanding-climate/climate-change-global-temperature">https://www.climate.gov/news-features/understanding-climate/climate-change-global-temperature</a>’</p><p>The following graph shows all the models we created so far on to the original timeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*LfOO54yPBMQ3I1y3iewy-A.png" /></figure><p>Ultimately, for this article we want to create another simple model of the global temperature, taking into account various other climate variables.</p><p>The next section intends to introduce these variables that will be used later.</p><h4>Annual Greenhouse Gas Index (AGGI)</h4><p>AGGI is a measure of the climate-warming influence of the long-lived greenhouse gases mainly: CO2, Methane, Nitrous Oxide, Chlorofluorocarbons, and other gases.</p><p>Let’s review a few concepts before we start using this AGGI index in our model.</p><p><strong>Longwave and shortwave radiation</strong>: short wave radiation is given off by the Sun and contains more energy compared to the longwave radiation emitted by the Earth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*xXr0MOS8U6UTqzxsthmTog.gif" /><figcaption>Credits: NASA-JPL/Caltech</figcaption></figure><p>Going back to the eponymous greenhouse effect, the greenhouse gases allow the Sun’s short wave radiation in, but absorbs the longwave radiation emitted by the Earth and reflects it back into the atmosphere and hence contribute to the warming.</p><p>Greenhouse gases are necessary for life on earth but climatologists are concerned about the rising level due to anthropogenic activities. Especially because the rate at which global warming is happening is unprecedented.</p><p>AGGI is plotted on the y-axis below, and you can see that Carbon Dioxide is the largest contributor to the index followed by Methane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*XumaAb4N6O34z6rG_uM5Ag.png" /></figure><p>Below is the pair-plot of major gases against the AGGI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wBMB8iwe9FIGSfLlJyqyFQ.png" /></figure><p>Did you notice a reverse hockey stick in the graph for CFC11 and CFC12 above? It looks like AGGI is higher even when the values of those gases are smaller.</p><h4>Stratospheric Aerosols</h4><p>Aerosols are any solid or liquid particles suspended in the air. For example, mineral dust, soot, black carbon, volcanic ash, etc. It is produced both naturally e.g sea spray or volcanic eruption, as well as due to human activities, like auto or industrial emission, smoking, and even cooking, and its presence affects us and the environment in numerous ways, such as causing various health hazards and changing both the global and local climate.</p><p>While the bulk of the aerosols are due to natural causes, we humans are not relenting in increasing pollutants in the air as well.</p><p>Within the atmosphere, the aerosols in the Troposphere are mostly due to vegetation, oceans, and deserts. The Aerosols in the stratosphere build up largely due to volcanic activities and can last a couple of years.</p><p>Here, we would specifically be looking at Stratospheric aerosols and how it relates to our investigation of global temperature anomaly over time.</p><p>Large explosive volcanoes inject sulfur dioxide into the stratosphere which reacts with the water vapors to form aerosols composed of sulfuric acid particles. This has a cooling effect on the Earth’s surface but not all is good, as always the case with most things, these aerosols are detrimental to the stratospheric ozone.</p><p>One measure to quantify aerosols in the atmosphere is Aerosol Optical Depth (AOD) and it relates to the amount of light scattered or absorbed in a column through the atmosphere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5KVivJb83xLnCBPn7rf5zg.png" /><figcaption>Annual Mean Stratospheric AOD at 550 nm (<a href="https://data.giss.nasa.gov/modelforce/strataer/">https://data.giss.nasa.gov/modelforce/strataer/</a> accessed on 1st May 2020)</figcaption></figure><p><a href="https://data.giss.nasa.gov/modelforce/strataer/">Data.GISS: Forcings in GISS Climate Model: Stratospheric Aerosol Optical Thickness</a></p><p>Apropos to the spikes in the above graph, few major volcanic eruptions corresponding to the timeline are:</p><ul><li>Krakatau in 1883 <a href="https://en.wikipedia.org/wiki/List_of_large_volcanic_eruptions_of_the_19th_century">https://en.wikipedia.org/wiki/List_of_large_volcanic_eruptions_of_the_19th_century</a></li><li>Mount Pinatubo in 1991 <a href="https://en.wikipedia.org/wiki/List_of_large_volcanic_eruptions_of_the_20th_century">https://en.wikipedia.org/wiki/List_of_large_volcanic_eruptions_of_the_20th_century</a></li></ul><h4>El Niño Southern Oscillation index</h4><p><strong>ENSO</strong>, the El Niño Southern Oscillation index, describes the linked phenomena of Southern Oscillation and El Niño. Southern Oscillation is the change in air pressure over the tropical Pacific Ocean whereas El Niño is the unusual pattern of warming of surface waters in the eastern tropical Pacific Ocean. When the coastal waters become warmer, the atmospheric pressure above the ocean decreases. Major phases of ENSO are La Niña, Neutral, and El Niño. It is a primary predictor of global climate disruptions.</p><p>We’ll be talking about eastern and western regions of the tropics of the Pacific Ocean, and a review is in order, mainly that the eastern Pacific Ocean is actually in the Western Hemisphere, and the western Pacific Ocean, in the Eastern Hemisphere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JbRBinNQm8V0xYztkwNAhA.png" /><figcaption>Attribution: <a href="https://upload.wikimedia.org/wikipedia/commons/b/b8/ENSO_-_normal.svg">Fred the Oyster / Public domain</a></figcaption></figure><p>In a neutral or normal phase, strong winds blow from east to west over the tropical Pacific Ocean and in the process push the warm surface waters to the western Pacific and allow the cooler waters to rise on the eastern coast such as on the coast of Peru or Ecuador. In this condition, the sea levels and the surface temperatures are higher in the western tropical region. E.g. higher in Indonesia compared to Ecuador and Peru.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uHbJL2N-RxsyIZizEuSxBw.png" /><figcaption>Attribution:<a href="https://upload.wikimedia.org/wikipedia/commons/2/2f/ENSO_-_El_Ni%C3%B1o.svg"> Fred the Oyster / Public domain</a></figcaption></figure><p>In the El Niño event, the trade wind weakens. It allows the warm water to move back towards the east and the thermocline, i.e. the level of ocean depth separating warm surface water from the colder water below, deepens. This prohibits upwelling i.e. rising of the cooler water to the surface, which in turn makes the water warmer and further weakens the trade winds. El Niño generally lasts for less than a year.</p><p>La Niña, on the other hand, is the cooling of the tropical western Pacific Ocean. The trade winds blow even stronger, expanding the warm water pool in the western tropical side of the pacific ocean and cooling the eastern i.e the South American side. This causes the temperature difference between the two sides to increase further, causing more water evaporation, clouds, and rains in the tropical western pacific. El Niño can last between one to three years.</p><p>Here, I’m using <strong>MEI</strong> which is Multivariate ENSO Index that combines atmospheric and oceanic variables: Sea Level Pressure (SLP), Sea Surface Temperature (SST), a zonal and meridional component of the surface wind, and outgoing longwave radiation (OLR), over the tropical Pacific basin.</p><p>Large positive values indicate the occurrence of El Niño conditions and large negative values of La Niña conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*pMXwzQODGftxmWCeP2WY0A.png" /></figure><h4>Total Solar Irradiance</h4><p>Total Solar Irradiance (<strong>TSI</strong>) measures the amount of radiant energy emitted by the Sun over all the wavelengths each second on a 1 square meter perpendicular plane outside Earth’s atmosphere.</p><p>Sun cyclically goes through dark and bright regions over eleven years period and although the primary source of energy on Earth, is not considered the main contributor to global warming.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*50cAUClpGC-9KIz-qQI-kQ.png" /></figure><h4>Considering AGGI, TSI, ENSO, and AOD in Global Temperature Estimations</h4><p>We can combine the data sets above to form a new data frame. Peaking at the tail shows as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*NsJCdWfydcxHLa4Nzl0aJA.png" /></figure><p>Exploration from now on would be on a scaled and normalized dataset.</p><p>We can look at the pair-plots of each explanatory variable against the global temperature anomaly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*4s6w6lxT2RmbC54fZdLhJw.png" /></figure><p>Consider the scatter plot of GISTEMP vs AGGI, for higher values of AGGI, there are higher values of GISTEMP. In the plot for GISTEMP vs AOD, more points and especially the higher points are closely huddled around the lower values of AOD. GISTEMP vs TSI, appears to have more points with higher value regardless of the GISTEMP but we do see some points on the left and center with lower GISTEPM.</p><p>The plot for ENSO vs GISTEMP looks to be more scattered.</p><p>Let’s look at TSI and GISTEMP and notice that there are several gaps where TSI and GISTEMP are diverging. Perhaps we can fill some of the gaps with other variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*2a4PT86EqKQ3E6d80ThgOA.png" /></figure><p>Let’s look at ENSO and GISTEMP and notice the timeline between~1991 to ~1994. It looks starkly opposite of each other and the global temperature is taking a dip.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*OkyUFAWDleUAQDasxO-KVQ.png" /></figure><p>We know that AOD has a cooling effect and we also know that there a major volcanic eruption of Mount Pinatubo. Plotting it over the previous graph shows a spike around ~1991 to ~1994 which can explain the drop in the global temperature anomaly. Another somewhat similar spike appears to be in the vicinity of ~1982 and also a dip in the temperature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*Ns9nZnuGYlqneRZzVhufGA.png" /></figure><p>Below is the graph showing TSI along with the above variables. It looks to me that in some cases where TSI is high but the temperature is low, I could find some other climate events to explain that. E.g. ~1999–2001 has higher TSI but shows a La Niña event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*uYzeITfDAuYYSIomldZx6g.png" /></figure><p>The period from 2010 onwards is showing the temperature line creeping up. There is an ENSO spike but it seems to be diverging from TSI. Let’ plot AGGI with temperature and ENSO.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*aLu18BO4ASd0TlGjHEPXLg.png" /></figure><p>The AGGI is also comparably higher 2010 onwards and perhaps contributing to the temperature increase.</p><p>Let’s look at the correlation coefficients and the p-values for all the variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*z809RaM1p5rhNjYKvlxEnQ.png" /></figure><p>All three methods are showing a positive correlation with the greenhouse gas index, and a negative correlation with Stratospheric Aerosols. The p-value for these are smaller than 0.5, so I think these correlations are viable.</p><p>Total Solar Irradiance (TSI) is also showing a moderate positive correlation with the temperature. ENSO values are not showing any correlation.</p><p>I’m not sure why AGGI is showing a strong correlation with AOD in the case of spearman.</p><h4>Linear Regression model with all the variables</h4><p>After fitting all combinations of the above variables in the OLS model, I found that the difference between the adjusted R2 of the variable combination that excludes TSI vs the model that takes into account all the variables is very small. It’s also the highest after the all-variable combination.</p><p>Adjusted R2 with ‘AGGI’, ‘ENSO’, ‘AOD_GLOBAL’, ‘TSI’ is 0.876</p><p>R2 with ‘AGGI’, ‘ENSO’, ‘AOD_GLOBAL’ is 0.869</p><p>Fitting TSI along with the rest of the variables gives it a negative co-efficient which doesn’t seem explainable because the temperature shouldn’t decrease with the increase in solar radiance, therefore I decided to drop that feature.</p><p>Finally, after fitting the dataset into scikit LinearRegression , the following equation is produced.</p><blockquote><strong><em>Global Temperature</em></strong><em> = 0.88 * </em><strong><em>AGGI</em></strong><em> + 0.22 * </em><strong><em>ENSO</em></strong><em> -0.23 * </em><strong><em>AOD</em></strong><em> +9.81e-17</em></blockquote><blockquote><strong><em>R2 Score</em></strong><em> = 0.879</em></blockquote><blockquote><strong><em>Adjusted R2 Score </em></strong><em>= 0.869</em></blockquote><h4>Conclusion</h4><p>As expected, we have a larger coefficient value for AGGI indicating a higher positive effect on the temperature, and the negative co-efficient for AOD, indicating that it has an effect of decreasing the temperature.</p><h4>Resources</h4><p>[1] Herring, S. C., N. Christidis, A. Hoell, M. P. Hoerling, and P. A. Stott, Eds., 2020: Explaining Extreme Events of 2018 from a<br>Climate Perspective. Bull. Amer. Meteor. Soc., 101 (1), S1–S128, doi:10.1175/BAMS-ExplainingExtremeEvents2018.1.</p><p>[2] Herring, S. C., A. Hoell, M. P. Hoerling, J. P. Kossin, C. J. Schreck III, and P. A. Stott, Eds., 2016: Explaining Extreme Events of<br>2015 from a Climate Perspective. Bull. Amer. Meteor. Soc., 97 (12), S1–S145.</p><p>[3] GISTEMP</p><ul><li>GISTEMP Team, 2020: GISS Surface Temperature Analysis (GISTEMP), version 4. NASA Goddard Institute for Space Studies. Dataset accessed 20YY-MM-DD at <a href="https://data.giss.nasa.gov/gistemp/">https://data.giss.nasa.gov/gistemp/</a>.</li><li>Lenssen, N., G. Schmidt, J. Hansen, M. Menne, A. Persin, R. Ruedy, and D. Zyss, 2019: Improvements in the GISTEMP uncertainty model. J. Geophys. Res. Atmos., 124, no. 12, 6307–6326, doi:10.1029/2018JD029522.</li></ul><p>[4] AGGI</p><ul><li><a href="https://www.esrl.noaa.gov/gmd/aggi/aggi.html">https://www.esrl.noaa.gov/gmd/aggi/aggi.html</a>)</li><li>Graphic: The Greenhouse Effect <a href="https://climate.nasa.gov/climate_resources/188/graphic-the-greenhouse-effect/">https://climate.nasa.gov/climate_resources/188/graphic-the-greenhouse-effect</a>/</li><li>Greenhouse effect <a href="https://courses.edx.org/assets/courseware/v1/f40bce9bb2f3570cc65b5303558ab895/asset-v1:SDGAcademyX+CCSI001+3T2019+type@asset+block/Module_1_Reading_5.pdf">https://courses.edx.org/assets/courseware/v1/f40bce9bb2f3570cc65b5303558ab895/asset-v1:SDGAcademyX+CCSI001+3T2019+type@asset+block/Module_1_Reading_5.pdf</a></li><li><a href="https://en.wikipedia.org/wiki/Multivariate_ENSO_index">https://en.wikipedia.org/wiki/Multivariate_ENSO_index</a></li></ul><p>[5] TSI</p><ul><li>ftp://ftp.pmodwrc.ch/pub/data/irradiance/composite/</li><li><a href="https://www.pmodwrc.ch/en/home/">https://www.pmodwrc.ch/en/home/</a>[6] Interpreting Correlations</li></ul><p>[6] Interpreting correlations</p><ul><li><a href="https://towardsdatascience.com/eveything-you-need-to-know-about-interpreting-correlations-2c485841c0b8">https://towardsdatascience.com/eveything-you-need-to-know-about-interpreting-correlations-2c485841c0b8</a></li></ul><p>[7] ENSO</p><ul><li>Graphics <a href="https://en.wikipedia.org/wiki/El_Ni%C3%B1o#/media/File:ENSO_-_normal.svg">https://en.wikipedia.org/wiki/El_Ni%C3%B1o#/media/File:ENSO_-_normal.svg</a></li><li>Graphics <a href="https://en.wikipedia.org/wiki/El_Ni%C3%B1o#/media/File:ENSO_-_El_Ni%C3%B1o.svg">https://en.wikipedia.org/wiki/El_Ni%C3%B1o#/media/File:ENSO_-_El_Ni%C3%B1o.svg</a></li><li><a href="https://www.nationalgeographic.org/encyclopedia/el-nino/">https://www.nationalgeographic.org/encyclopedia/el-nino/</a></li><li><a href="https://www.nationalgeographic.org/encyclopedia/la-nina/">https://www.nationalgeographic.org/encyclopedia/la-nina/</a></li><li><a href="https://psl.noaa.gov/cgi-bin/data/climateindices/corr.pl?tstype1=27&amp;custname1=&amp;custtitle1=&amp;tstype2=0&amp;custname2=&amp;custtitle2=&amp;year1=&amp;year2=&amp;itypea=0&amp;y1=&amp;y2=&amp;plotstyle=0&amp;length=&amp;lag=&amp;iall=0&amp;iseas=1&amp;mon1=0&amp;mon2=11&amp;anom=1&amp;climo1_yr1=&amp;climo1_yr2=&amp;climo2_yr1=&amp;climo2_yr2=&amp;Submit=Calculate+Results">https://psl.noaa.gov/cgi-bin/data/climateindices/corr.pl?tstype1=27&amp;custname1=&amp;custtitle1=&amp;tstype2=0&amp;custname2=&amp;custtitle2=&amp;year1=&amp;year2=&amp;itypea=0&amp;y1=&amp;y2=&amp;plotstyle=0&amp;length=&amp;lag=&amp;iall=0&amp;iseas=1&amp;mon1=0&amp;mon2=11&amp;anom=1&amp;climo1_yr1=&amp;climo1_yr2=&amp;climo2_yr1=&amp;climo2_yr2=&amp;Submit=Calculate+Results</a></li><li><a href="https://www.climate.gov/news-features/understanding-climate/el-ni%C3%B1o-and-la-ni%C3%B1a-frequently-asked-questions">https://www.climate.gov/news-features/understanding-climate/el-ni%C3%B1o-and-la-ni%C3%B1a-frequently-asked-questions</a></li><li><a href="http://faculty.washington.edu/kessler/occasionally-asked-questions.html#q1">http://faculty.washington.edu/kessler/occasionally-asked-questions.html#q1</a></li><li><a href="https://www.youtube.com/watch?v=dzat16LMtQk">https://www.youtube.com/watch?v=dzat16LMtQk</a></li><li><a href="https://psl.noaa.gov/enso/mei/">https://psl.noaa.gov/enso/mei/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b0cefb8603c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Function, lambda, and switching on strings]]></title>
            <link>https://ambreen2006.medium.com/function-lambda-and-switching-on-strings-b5dc001efb35?source=rss-a5b3e93ed78c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5dc001efb35</guid>
            <dc:creator><![CDATA[Ambreen H.]]></dc:creator>
            <pubDate>Sun, 26 Apr 2020 23:42:34 GMT</pubDate>
            <atom:updated>2020-04-26T23:42:34.875Z</atom:updated>
            <content:encoded><![CDATA[<p>In the same spirit as that of my last post, I found myself needing to compare strings that my hobby project is receiving on command line arguments and to take specific actions based on what was passed.</p><p>The usual if-else statement felt like a lot of typing and I thought why not just use lambdas to dictate what needs to be done and use the unordered_map to match the string and execute the appropriate lambda.</p><p>Ergo, I got started on this task. I know I need a hash map of a sort and although in C++, keys don’t need to be string, given my current needs, I went with std::string. Now, there is the question of how to associate the lambdas as values, and that’s where std::function comes into play.</p><h3>Encapsulating the behavior</h3><p>I also want to tie everything together, So I went with a struct.</p><pre>struct Switch {<br>    using void_function = std::function&lt;void(void)&gt;;<br>    std::unordered_map&lt;std::string, void_function&gt; cases;<br>...<br>    Switch() {}<br>};</pre><p>Now comes the part of populating the hash map and that’s below:</p><pre>void add_case(std::string const &amp; key, void_function func) {<br>    cases[key] = func;<br>}</pre><p>Now, I want to be able to just do this and execute the correct flow:</p><pre>Switch s;<br>// adding some cases<br>...<br>s(to_switch_on)</pre><p>For that, I’m going to overload the call operator and have it take the key as an input parameter:</p><pre>void operator()(std::string const &amp; key) {<br>...<br>}</pre><p>Now, I have two tasks, check if the key exists, if it does execute the function associated with it. If not, check if any key is set for ‘default’ case (because why not), otherwise for the time being, just print an error. I could later in the future, throw an exception, in such a situation.</p><pre>void operator()(std::string const &amp; key) {<br>    auto f = cases.find(key);<br>    f = (f == cases.end()) ? cases.find(&quot;default&quot;) : f;<br>    if (f == cases.end()) { <br>        std::cout &lt;&lt; &quot;Case not found and default not set\n&quot;;<br>        return;<br>    }<br>    f-&gt;second();<br>}</pre><h3>Using the string switcher</h3><p>Okay, with that much done so far. I could, for example, use this struct as follows:</p><pre>std::string message = &quot;c&#39;est la vie&quot;;</pre><pre>Switch s;<br>s.add_case(&quot;&quot;, [&amp;message](void) {<br>                 std::cout &lt;&lt; message &lt;&lt; std::endl;<br>                });<br><br>s.add_case(&quot;d&quot;, [msg=&quot;cogito ergo sum&quot;]{<br>                  cout &lt;&lt; msg &lt;&lt; endl;<br>                });</pre><pre>s(&quot;live_your_life&quot;);<br>s(&quot;i_think_therefore_i_am&quot;);<br>s(&quot;not_existing_key&quot;);</pre><p>Output for that would be:</p><pre>c&#39;est la vie<br>cogito ergo sum<br>Defaul switch case</pre><p>In my hobby project, I collapsed the if-else-if as follows:</p><pre>Switch s;<br>s.add_case(&quot;projects&quot;,[&amp;]{this-&gt;showProjects();});<br>s.add_case(&quot;add&quot;,     [&amp;]{this-&gt;addProjects(arguments); });<br>s.add_case(&quot;latest&quot;,  [&amp;]{this-&gt;showLatest(arguments)});<br>s.add_case(&quot;time&quot;,    [&amp;]{this&gt;startTimer(arguments)});<br>s.add_case(&quot;stop&quot;,    [&amp;]{this-&gt;stopTimer(arguments); });<br>s.add_case(&quot;today&quot;,   [&amp;]{this-&gt;showTimeSpentToday(arguments);});</pre><pre>s(command);</pre><p><a href="https://github.com/ambreen2006/exercises/blob/master/CPlusPlusReview/create_simple_iterator.cpp">ambreen2006/exercises</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5dc001efb35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring date and time with chrono]]></title>
            <link>https://ambreen2006.medium.com/exploring-date-and-time-with-chrono-3a8e9af60f62?source=rss-a5b3e93ed78c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a8e9af60f62</guid>
            <dc:creator><![CDATA[Ambreen H.]]></dc:creator>
            <pubDate>Tue, 21 Apr 2020 23:37:01 GMT</pubDate>
            <atom:updated>2020-04-21T23:37:01.535Z</atom:updated>
            <content:encoded><![CDATA[<p>There is a hobby project that I’m doing and found myself in need of using date/time facilities available in the chrono library. My tasks at this stage are simple:</p><ol><li>Get the current date and time</li><li>Get date and time beginning midnight</li><li>Do some comparison between (1) and (2)</li></ol><p>There are two clocks of interest in the chrono library: system_clock and steady_clock. What is a clock you may ask? Well, in this context, a clock is a time provider that has a starting point (epoch) and tick rate.</p><p>system_clock is a system-wide wall clock and it is better suited for my tasks at hand as I’m interested more in the calendrical operation. The steady clock, on the other hand, is more appropriate for stopwatch like functionality.</p><p>Most implementations use the epoch 00:00:00 Coordinated Universal Time (UTC) for system_clock.</p><p><strong>Task 1: Get the current date and time</strong></p><p>There is a static method available to get the current time_point:</p><pre>auto current = chrono::system_clock::now();</pre><p>That method returns a <strong>time_point</strong> which as the name suggests, a point in time and it is tied to the clock with respect to the duration from the epoch of the clock.</p><pre>auto now_timet = chrono::system_clock::to_time_t(current);<br>auto now_local = localtime(&amp;now_timet);<br>cout &lt;&lt; &quot;Local Time &quot; &lt;&lt; put_time(now_local, &quot;%c&quot;) &lt;&lt; endl;</pre><pre>output:<br>Local Time Tue Apr 21 17:56:27 2020</pre><p><strong>to_time_t</strong> converts that <strong>time_point</strong> to <strong>time_t</strong> which is represented as an integral type holding number of seconds since 00:00, Jan 1, 1970, UTC.</p><p>E.g output below, if you print <strong>time_t</strong>:</p><pre>cout &lt;&lt; &quot;As time_t &quot; &lt;&lt; now_timet &lt;&lt; endl;</pre><pre>output:<br>As time_t 1587506187</pre><p><strong>localtime</strong> could then take that <strong>time_t</strong> and express it in local calendar time.</p><p><strong>Task 2: Get the date and time from midnight</strong></p><p>For this task, I can set hours, mins and seconds to 0 in the <strong>std::tm </strong>struct.</p><pre>auto midnight_local = now_local;<br>midnight_local-&gt;tm_hour = 0; <br>midnight_local-&gt;tm_min = 0; <br>midnight_local-&gt;tm_sec = 0;</pre><p>Then convert it to number of seconds since epoch i.e. <strong>time_t</strong> by using <strong>mktime</strong></p><pre>auto midnight_timet = mktime(midnight_local);<br>cout &lt;&lt; &quot;As time_t &quot; &lt;&lt; midnight_timet &lt;&lt; endl;</pre><pre>output:<br>As time_t 1587441600</pre><p>Let’s say, if I have persisted the time_t value and later on needs to get back the <strong>time_point</strong> for further operations, I can do so:</p><pre>auto midnight = chrono::system_clock::from_time_t(midnight_timet);</pre><p><strong>Task 3: Do some comparison between (1) and (2)</strong></p><p>I could just use the time_t or chrono::duration to make some tasks simpler. E.g.</p><pre>auto diff_mins = std::chrono::duration_cast&lt;std::chrono::minutes&gt;(current - midnight);<br>auto diff_hrs = std::chrono::duration_cast&lt;std::chrono::hours&gt;(current - midnight);<br>cout &lt;&lt; &quot;Minutes passed since midnight &quot; &lt;&lt; diff_mins.count()  &lt;&lt; endl;<br>cout &lt;&lt; &quot;Hours passed since midnight &quot; &lt;&lt; diff_hrs.count()  &lt;&lt; endl;</pre><pre>output:<br>Minutes passed since midnight 1076<br>Hours passed since midnight 17</pre><p><strong>Wrap Up:</strong></p><p>My objective is to be able to query records with a field storing the time_t representation satisfying some conditions. In the example above, the condition being the ability to determine the start of the day (i.e. midnight) and now i.e. current date and time.</p><p><a href="https://github.com/ambreen2006/exercises/blob/master/DateAndTime/date_time_1.cpp">https://github.com/ambreen2006/exercises/blob/master/DateAndTime/date_time_1.cpp</a></p><p><strong>References:</strong></p><p><a href="https://en.cppreference.com/w/">https://en.cppreference.com/w/</a></p><p>Howard Hinnant “A ＜chrono＞ Tutorial”:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPLq7KXmQCao4sFSrX0zstuXmEvpe0u0lka%26start%3D0&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DP32hvk8b13M&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FP32hvk8b13M%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/60a51577bbcdd35452e61682e8418810/href">https://medium.com/media/60a51577bbcdd35452e61682e8418810/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a8e9af60f62" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>