<?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 Hana Phan on Medium]]></title>
        <description><![CDATA[Stories by Hana Phan on Medium]]></description>
        <link>https://medium.com/@phanhnghnh?source=rss-a22f980db9be------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*zaXgJ63zG_i9ekgh.</url>
            <title>Stories by Hana Phan on Medium</title>
            <link>https://medium.com/@phanhnghnh?source=rss-a22f980db9be------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:47:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@phanhnghnh/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[How is a data engineer life in Shopee]]></title>
            <link>https://medium.com/@phanhnghnh/how-is-a-data-engineer-life-in-shopee-af857e2f65b4?source=rss-a22f980db9be------2</link>
            <guid isPermaLink="false">https://medium.com/p/af857e2f65b4</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[shopee]]></category>
            <dc:creator><![CDATA[Hana Phan]]></dc:creator>
            <pubDate>Sun, 29 Oct 2023 09:32:28 GMT</pubDate>
            <atom:updated>2023-10-29T09:32:28.265Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi all, I have been working at Shopee for more than 2 years, and today I’m really thrilled to tell my story of how I got into one of the biggest e-commerce companies in Southeast Asia and what data engineers&#39; lives look like in the company.</p><p>To begin with, I’m gonna share my journey to Shopee. In 2019, I relocated to Singapore with a job as titling Quantitative Developer in a hedge fund company. I really appreciated this company giving me the opportunity to move to Singapore, however, the job content did not really suit me well. The reason is that I’m always into all the things related to big data or data engineering. After 2 years, despite worries about losing the work pass, I took a big step in my career, I participated in an Engineer interview for Shopee.</p><p>The interview process included 4 rounds. The online round is an online assessment using dequeue to solve. I used Python as my programming language. From my perspective, I think the question is easy on Leetcode. A few days later, HR contacted me and informed me that I passed and went to the next round. In the first interview, I was excited because my interviewer is Vietnamese as me. Honestly, I hoped he could talk to me in Vietnamese, cause I was not good at English at that time. Lol, I was so dumb, wasn’t I? But for professionals, our talk was in English. The interview was quite smooth, he started with a warm-up question (two-sum on Leetcode). I can solve the question easily with Hash Map. The interesting part was a follow-up question about solving the problem in a big data context. I could not answer it immediately because of my lack of experience working with big data. Luckily, he gave me one hint and I can solve it with the spark code. The first round went well. I got a pass and went to the second round and third round on the same day. The second interviewer is my boss eventually. I remember that my boss asked me some technical questions related to data engineering but I got them all wrong. One of the questions was which protocol between the server and clients in the Spark cluster. I managed to answer TCP but when he asked what was TCP, I could not answer clearly. Fortunately, he guessed I did not have data engineering experience, so he asked me 2 more coding questions, one was Depth First Search problem, and one was about hard copy for a LinkedList. I tackled them very fast and proved my strong problem-solving skills. The third round was with the big boss, he asked me to solve a question related to sorting a large amount of data (20 GB) on a machine with RAM 2GB. He followed up with some behavior questions.</p><p>I believe that I did just well enough to pass the interview. Now when I recall the process, I still feel lucky that I embraced the opportunity. Actually, I didn’t have a good background for the role at that time, but I tried my best to show what I really had, such as my problem-solving, my passion.</p><p>In this part, I’m gonna share about how is the structure of my team and what I have been doing in Shopee as a data engineer.</p><p>My team is a data team, the so-called Data Intelligence team. Our team’s goal is to build, to maintain all data pipelines serving for Recommendation and Search of Shopee. We often worked with the Algorithm team, and online service team (recall, mixer, ranker team), QA team. Our requirements are normally from the algorithm team. We need to build reliable pipelines to serve them clean and useful data so that they can use them to build model, or dashboards, and eventually improve their algorithm for recommendation and search (two of the most important features in an e-commerce platform).</p><p>Our team is divided into two small sub-teams by business. One is the analytics team, which processes all the pipeline-related analytics. The other is the feature team, which builds feature data (normally for use in model-building). By function, the team can be divided into batch and streaming sub-teams. While batch jobs are used in building data warehouses or initial data in Lambda architecture, streaming jobs are utilized for continuous ingestions. Because I have worked in all those sub-teams, from my perspective, feature requirement is often more crucial than analytics and the streaming job is usually more challenging than a batch job.</p><p>Regarding the tech stacks, we use Spark and Scala for batch processing and Flink versus Java for streaming processing. The thing I love while working at Shopee is that I can touch many types of big data storage and frameworks. For example, for distributed storage: Hadoop, Hive; for OLAP (online analytics processing): Druid, Clickhouse; for Message Queue: Kafka; for OLTP (online transaction processing): Hbase, Redis, Feature storage engine; etc. I will tell more in another post about all those stacks.</p><p>About the development life cycle, the team already has a full cycle (dev, build, run, monitor, alert) to develop a data pipeline. Therefore, as a data engineer, I only need to focus on designing and developing the pipeline. I think one of the parts we need to improve is data quality which we can add into the life cycle. Nowadays, we are using help from testers, but in my opinion, there are some drawbacks by using this method. Firstly, testers are using manual tests and sometimes they are not reliable. Secondly, the test process requires a lot of work when cooperation between data engineers and testers is required.</p><p>When I received a requirement from cross-team. The first thing I need to do is have a meeting with them, and clarify all the requirements they give, such as latency, storage, output API, or dashboards… Later on, work with PM about the timeline, QA, or tester arrangement if needed. Normally, I start the project with a technical design for a complex project, involving many different pipelines and storage. Another meeting is held eventually to discuss the design. I only begin coding when all the above steps are cleared. When coding and self-tests are done, I transfer to QA to test data quality. If the tests are passed, the data is served production and the project will be marked done. However, my data jobs are streaming and scheduler batching, so if they face any issues, I’m the person to resolve them. It means that besides all new project development, I need to maintain all the pipelines I have done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZOz97AMdjnfw7K9qXvAbvg.png" /><figcaption>An example of my data pipeline design for a project</figcaption></figure><p>Last but not least, the part I love most when I build a pipeline is optimization. Because if the job is streaming, every second of latency counts. To do the optimization, I need to configure the proper resources and try to tune every step in a pipeline. Sometimes, need to think about more optimal solutions, or use other optimized techniques, such as cache, keyed streaming, etc. Those optimizations are not obvious, I need to try and error or deeply think about the mechanism of frameworks to find out some parts I can improve. But you know, sometimes, you only need to understand the characteristics of your data, you already can make a great improvement for your pipeline.</p><p>In conclusion, with the high volume of data and special scope (e-commerce), I believe that Shopee is a good company to work as a big data engineer. You can dump yourself into the grandeur of big data and all the related business behind it. You’ll have a chance to work with many big data frameworks and storage, eventually improving your skills and knowledge in this big area.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af857e2f65b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A lovely lemma for calculating expected value]]></title>
            <link>https://medium.com/@phanhnghnh/a-lovely-lemma-for-calculating-expected-value-5da73eec4c80?source=rss-a22f980db9be------2</link>
            <guid isPermaLink="false">https://medium.com/p/5da73eec4c80</guid>
            <category><![CDATA[lemma]]></category>
            <category><![CDATA[expected-value]]></category>
            <category><![CDATA[probability]]></category>
            <dc:creator><![CDATA[Hana Phan]]></dc:creator>
            <pubDate>Mon, 25 May 2020 02:12:31 GMT</pubDate>
            <atom:updated>2020-05-25T05:51:21.689Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*jP3dYKE94yZfFfDAtrr9cA.gif" /><figcaption>Sometimes, our believe can not decide our destiny?</figcaption></figure><p>Last week, when I improved my probability knowledge from <a href="http://web.stanford.edu/class/archive/cs/cs109/cs109.1166//handouts/overview.html">CS109</a>, I suddenly felt in love with an equation for calculating expected value or expectation of a random variable. This equation is simple but effective in many cases.</p><blockquote>Life give you lemmas, make lemmanade</blockquote><h4>Definition and traditional equation for Expectaion</h4><p>First, what is expected value? <strong>Expected value is the average value of a random variable over a large number of experiments or the return you can expect for some kind of action.</strong><br>To calculate expected value, you can use some of those following forms.</p><ul><li><strong>Finite case:</strong> Let <strong><em>X</em></strong> be random variable with a finite number of outcomes <em>x_1, x_2, …, x_k</em> occuring with probabilities <em>p_1, p_2, …, p_k</em>. Expectation of X equals:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/178/1*0kccSD8DlzCwM-BoqZRgYQ@2x.png" /></figure><ul><li><strong>Countable infinite case</strong>: Let <strong><em>X</em></strong> be a non-negative random variable with a countable set of outcomes <em>x_1, x_2, …</em> occuring with probabilities <em>p_1, p_2, …</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/178/1*jHJnYBJjLQF0g1M_TzdJfA@2x.png" /></figure><ul><li><strong>Continuous case</strong>: Let <strong><em>X</em></strong> be a random variable with a probability density function <em>f(x</em>), then the expected value of <strong><em>X</em></strong> is defined:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/171/1*ibKshc6VZoI35Mu3p98VHA@2x.png" /></figure><h4>Example</h4><p>Go ahead and find the Expectation value for Geometric random variable X.</p><p><em>X ~ Ber(p)</em></p><p><em>Y ~ Geo(p)</em> # Number trials of <em>X</em> until first success</p><p>Use countable infinite form, we have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*lM2ZpX6c1Y0N7khqEfj9MQ@2x.png" /></figure><p>From the last equation, how can we move to the final answer?? It look not easily. However, with following lovely lemma, we can solve this problem without difficulty.</p><h4>Another lovely form for Expectation calculation</h4><ul><li>Discrete form:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*R9vnoA-X_ZN_0FdHM-HWJw@2x.png" /></figure><ul><li>Continuous form: <strong><em>X</em></strong> should be non negative</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/1*M4qJP2--X7f10EIujeDnww@2x.png" /></figure><h4>Application</h4><ol><li>Geometric random variable:</li></ol><p>We have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*AIYkS5ygmz6ugpBXcm1fYg@2x.png" /></figure><p>You see, using our lovely lemma makes our life much easier.</p><p>2. Imperfections on disk</p><p>Disk surface is a circle of radius R. A single point imperfection uniformly distributed on disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*ELFfw42Gpmh0YCF8VXP3qQ@2x.png" /></figure><p>Let distance from a point (<em>X,Y</em>) to origin equal <em>D=sqrt(X²+Y²)</em>. Calculate <em>E[D].</em></p><p><strong>Solution:</strong></p><p>First, we calculate probability for a point with distance less than or equal <em>a</em>. Because of uniform distribution, this probability equals to the ratio between area of circle with radius a and the area of our disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/1*mYnnll5hWPlNKU-bPp5U7Q@2x.png" /></figure><p>Then, applying our lemma, we have</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*seDBOgqfnUU1-40tzDIspQ@2x.png" /></figure><p>If we use normal calculation, it become so hard to find expectation for D. Our lovely lemma gives us the solution in only four or five mutations.</p><p>That’s all for my discovery. I hope you guys enjoy it and start love probability, it’s really awesome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5da73eec4c80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data visualization with Python]]></title>
            <link>https://medium.com/@phanhnghnh/data-visualization-with-python-c6f63bc59fa5?source=rss-a22f980db9be------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6f63bc59fa5</guid>
            <dc:creator><![CDATA[Hana Phan]]></dc:creator>
            <pubDate>Fri, 21 Feb 2020 13:35:55 GMT</pubDate>
            <atom:updated>2020-02-21T13:35:55.601Z</atom:updated>
            <content:encoded><![CDATA[<p>I started with data science 3 months ago. The first problem I dealt with was NY taxi trip duration prediction problem on Kaggle website. Hmm, how I did when I was dropped into a new area which I am not familiar with. Yeah, I found the solution and imitated them. I spent only one day to finish coding a regression algorithm with py-spark for this problem. It is possible because all functions are supported by libraries. However, when my instructor asked me how can I found the range to eliminate outliers, it was very stupid for me when I said I just found the answer on Google. It was exactly the time I learned 2 big lessons in my life. First, always asking why before how. Second, do not spend 1 hour on coding and only 1 minute on thinking. Since this moment, I started thinking and figured out how can I find the answer to my instructor’s question. It is by visualization.</p><p>I knew this part is nothing groundbreaking. However, as a newbie, I found that there are a lot of libraries and functions which can make newbies like me lost. As a result, based on all the documents I read, I summarize all the knowledge in this following notebook. I hope it can give you all an overview of both non-interactive and interactive way for data visualization by Python.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2004752bffee0177eb741b623ffbf3e2/href">https://medium.com/media/2004752bffee0177eb741b623ffbf3e2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6f63bc59fa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>