<?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 Kai Cui - Senior Data Scientist on Medium]]></title>
        <description><![CDATA[Stories by Kai Cui - Senior Data Scientist on Medium]]></description>
        <link>https://medium.com/@kaicui726?source=rss-b861f53dea66------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*74sBz6v5SJigtSOW_fQ8vg.jpeg</url>
            <title>Stories by Kai Cui - Senior Data Scientist on Medium</title>
            <link>https://medium.com/@kaicui726?source=rss-b861f53dea66------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:31:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kaicui726/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[Precision, Recall, Accuracy, and Confusion Matrix]]></title>
            <link>https://kaicui726.medium.com/precision-recall-accuracy-and-confusion-matrix-278ae2ed2dfb?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/278ae2ed2dfb</guid>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Tue, 12 Nov 2024 22:10:23 GMT</pubDate>
            <atom:updated>2024-11-12T22:41:04.520Z</atom:updated>
            <content:encoded><![CDATA[<p>Precision, Recall, Accuracy, and F1 score are all metrics used to evaluate how well a binary classier is performing. A confusion matrix can help us understand in detail</p><ol><li>how correct the model is (true positives and true negatives)</li><li>how wrong the model is (false positives and false negatives)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZTSIaVLIpmrM4935uVS87g.png" /><figcaption>Confusion Matrix with Dog Detection as an Example</figcaption></figure><p>In this article, we discuss the definition of these metrics and how to choose one that’s most representative of your objective when tradeoffs are required.</p><h3>Precision</h3><p>Precision answers the question: out of all the positive predictions, how many were actually positive?It ’s calculated as</p><blockquote><em>Precision = True Positive / (True Positive + False Positive)</em></blockquote><p>In the confusion matrix from above, it’s the ratio of images in row 1 column 1 to the sum of images in row 1.</p><p>When the cost of false positive is high, we want to maximise precision. Some examples are</p><blockquote>E.g. 1: A search engine needs to return highly relevant web pages to be useful. Otherwise users will turn to competitors. Therefore false relevant pages need to be minimised and high precision is required.</blockquote><blockquote>E.g. 2: A spam detector needs to filter out spam content and retain relevent emails. Otherwise a user might miss out important information. False spam need to be minimised. Therefore high precision is required.</blockquote><blockquote>E.g. 3: In fraud detection, we also rely on a high precision to avoid friction of normal transactions while able to catch most fraudulent activities.</blockquote><h3>Recall (Sensitivity)</h3><p>Recall answers the question: out of all the positives, how many were correctly predicted? It’s calculated as</p><blockquote><em>Recall = True Positive / (True Positive + False Negative)</em></blockquote><p>In the confusion matrix from above, it’s the ratio of images in row 1 column 1 to the sum of images in column 1.</p><p>When the cost of false negative is high, we want to maximise recall. This minimises missed positives (as they are incorrectly identified as negatives). Some examples are</p><blockquote>E.g. 1: A smoke alarm is designed to have a high recall so that any potential fire hazard will be detected. This is because failing to detect a real fire (the mistake of false negative) can cost people’s life.</blockquote><blockquote>E.g. 2: In lethal disease screening, a high recall is more responsible because missing a positive (the mistake of false negative) can lead to disastrous outcomes for the patient.</blockquote><blockquote>E.g. 3: When a mortgage company needs to prioritise which phone number to call to followup for a potential deal, a higher recall is more desirable. The cost of calling a potential client is low but the cost of missing to call a highly likely buyer is high.</blockquote><h3>F1 Score</h3><p>F1 score is the harmonic mean of precision and recall. It’s calculated as</p><blockquote><em>F1 = 2 * Precision * Recall / (Precision + Recall)</em></blockquote><p>It takes a balanced approach to precision and recall. Maximising F1 score is preferred when false positives and false negatives are equally costly. Some examples are</p><blockquote>E.g. 1: In moderate risk disease screening, we want a balanced precision and recall where false positives can lead to additional tests and false negatives can lead to further development of conditions but not deadly.</blockquote><blockquote>E.g. 2: When identifying defective products, a balance of high precision and high recall is deployed. Missing defective items (false negatives) can lead to quality issues for customers, while incorrectly classify good items as defective (false positives) increases waste and costs.</blockquote><h3>Accuracy</h3><p>Accuracy answer the question: how many times the prediction is correct? It’s calculated as</p><blockquote><em>Accuracy = (True Positive + True Negative) / (Total Positive + Total Negative)</em></blockquote><p>It measure the overall correct rate without distinguish false positives and false negatives. Choose accuracy to evaluate the model when false positive and false negative have similar costs and significancy (volume of such errors) and there is no need to emphasise one type of error over another.</p><p>Hope you find this article helpful when deciding the tradeoff of precision and recall.</p><h3>Summary</h3><p>Precision tells us how accurate the positive predictions are. Recall tells us how complete the positive predictions are. Accuracy tells us how accurate the predictions are. F1 tell us how accurate and complete the positive predictions are.</p><h4>Reference:</h4><ol><li><a href="https://machinelearningmastery.com/tour-of-evaluation-metrics-for-imbalanced-classification/">Evaluation Metrics for Unbalanced Classification</a></li><li><a href="https://en.wikipedia.org/wiki/F-score">F Score Wiki</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=278ae2ed2dfb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Workflow for Data Scientists]]></title>
            <link>https://kaicui726.medium.com/git-workflow-for-data-scientists-44bb5ffe678e?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/44bb5ffe678e</guid>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Tue, 12 Nov 2024 01:23:20 GMT</pubDate>
            <atom:updated>2024-11-12T22:21:06.356Z</atom:updated>
            <content:encoded><![CDATA[<p>Knowledge of git workflow has appeared in many data scientists’ job descriptions. It’s no surprise since most of the data science projects require an iterative approach. Clear documentation and version control can save you lots of time when you need to come back to a previous project and make improvements. Git repo is a very useful tool for this purpose. It also saves all your work in a remote repo that you can access from any device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kw8qV1x1cBkc402l" /><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article, I will share the common commands and git workflow I have been using in the past few years.</p><h3>Part 1: Start A Git Repository And Commit Changes</h3><p>There are two ways to start a git repo. If you are starting from scratch with no remote repo, simply navigate to your desired local directory, make a folder, and initialise the folder as a git repo with the following shell command in terminal on Mac</p><pre># when starting from scratch<br>$ mkdir project <br>$ cd project <br>$ git init<br><br># when starting from scratch alternatively<br>$ git init &lt;directory&gt;</pre><p>If you are starting from an existing git repo that has a remote location, you can cd change directory into the desired location and copy it with git clone followed by the url of that repo.</p><pre>$ git clone &lt;https://github.com/OWNER/REPOSITORY.git&gt;</pre><p>With this repo created, you can start to create new branches and new files to this repo. Some often used commands are</p><pre># create a new branch replace 1-new-sql with actual name<br>$ git branch 1-new-sql<br><br># checkout from the master branch to the new branch <br>$ git checkout 1-new-sql<br><br># show all the git branch<br>$ git branch -a<br><br># check what you have created or changes so far<br>$ git status<br><br># show the difference <br>$ git diff<br><br># add all new changes to staging area<br>$ git add . <br><br># commit changes to staging area<br>$ git commit -m &quot;message you want to include in this commit&quot;<br><br># push changes to the remote branch <br>$ git push -u origin 1-new-sql</pre><h3>Part 2: Review Commits And Merge To Master</h3><p>After the local changes have been committed to the remote branch, code review can take place. This is the chance to catch possible erros if this is production level code.</p><pre># checkout the master branch <br>$ git checkout master <br><br># pull from the master branch in case changes have been made by teammates<br>$ git pull origin master<br><br># look at merged branch<br>$ git branch --merged<br><br># merge branch 1-new-sql to the master<br>$ git merge 1-new-sql <br><br># push changes to the remote master branch <br>$ git push origin master </pre><h3>Part 3: Cleaning After Merge</h3><p>Now you have committed changes and your code is reviewed and merged. It’s time to cleaning everything up and keep the repo tidy.</p><pre># look at merged branch <br>$ git branch --merged<br><br># delete branch 1-new-sql locally <br>$ git branch -d 1-new-sql<br><br># push the delete action to the remote repo as well <br>$ git push origin --delete 1-new-sql</pre><p>That’s the last bit. Now you can take this workflow with you to all the future data science projects for better version control, team collaboration, and documentation. Hope you find it helpful.</p><p>Reference:</p><p>Git Tutorial for Beginners: Command Line Fundamentals by Corey Schafer <a href="https://www.youtube.com/watch?v=HVsySz-h9r4&amp;t=1s">https://www.youtube.com/watch?v=HVsySz-h9r4&amp;t=1s</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44bb5ffe678e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Hands-on Guide to AB Test — Part 1]]></title>
            <link>https://kaicui726.medium.com/a-hands-on-guide-to-ab-test-part-1-e7a76a7a3b56?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7a76a7a3b56</guid>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Sun, 03 Nov 2024 23:41:39 GMT</pubDate>
            <atom:updated>2024-11-03T23:41:39.718Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Hands-on Guide to AB Test — Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vDTK7Tm9QPHVNLrh" /><figcaption>Photo by <a href="https://unsplash.com/@paucasals?utm_source=medium&amp;utm_medium=referral">Pau Casals</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Experimentation is a critical process for scientific discovery. It is especially useful in establishing causal relations between intervention (cause) and effect.</p><p>Among many causal inference techniques, the most popular one is AB Test. It is a randomised controlled trail (RCT) where each unit (user/geo/day) is randomly assigned to a control group and treatment (with intervention) group. By comparing the results from the two groups, we can infer that the difference is caused by the intervention.</p><p>In this article, I will share the basic steps of running an AB Test with some detailed examples.</p><h3>Stage 1: Generate Hypothesis</h3><p>AB test starts with a “what if” question. Imagine it’s Tuesday, you are commuting to work by tube and you are running late because of signal failures on Central Line. You wonder what if you had taken the Circle Line instead, would you be on time? This is a hypothesis we can test.</p><p>Hypothesis could be based on observation, intuition, or speculation. A good hypothesis makes casual claims between the treatment and effect. For example:</p><blockquote>Experiment 1 Hypothesis: By switching to Circle Line from Central Line during morning commute, I can increase my on time rate.</blockquote><p>Expand this “what if” concept to business settings, one common hypothesis is:</p><blockquote>Experiment 2 Hypothesis: By welcoming new customers with a special discount for their first purchase, we can increase conversion rate.</blockquote><p>Notice that the hypothesis states the conditions of the control and treatment variant with measurable outcome. They will be used in the next stage of the process.</p><h3>Stage 2: Experiment Design</h3><p>There are three parts in designing the experiment.</p><ul><li>How to decide if treatment is better?</li><li>How to assign treatment and control?</li><li>How long to run the test?</li></ul><p>In order to prove or disprove the hypothesis, the built-in measurable outcomes should be the criteria of success.</p><blockquote>Experiment 1 Success Metric: on time rate (NTR)</blockquote><blockquote>Experiment 2 Success Metric: conversion rate (CVR)</blockquote><p>The next part is determine the randomisation units and assign them randomly with the control variant and treatment variant. In experiment 1, the only possible randomisation unit is commuting day.</p><blockquote>Experiment 1 Assignment Mechanism: Randomly assign all commuting days equally into the control variant (Central Line) and treatment variant (Circle Line) and keep everything else the same.</blockquote><p>In experiment 2, the randomisation unit can be each visit, each user (cookie id &amp; device id pair as an approximation), each day, and each region. Randomising on visit or day creates inconsistent user experience. Randomising on region requires additional preparation to ensure parallel trends. (This will be a latter topic.) In this case, user is the most logical and convenient randomisation unit.</p><blockquote>Experiment 2 Assignment Mechanism: Randomly assign all website visitors into the control variant (without new customer discount) and treatment variant (with new customer discount) and keep everything else the same.</blockquote><p>The last part in stage two is deciding how long the test should run. To answer this, we need to do power analysis. Power analysis gives us the minimum amount of samples (randomisation unit) required to detect a pre-selected minimum detectable effect (MDE) at desired levels of confidence and power.</p><p>Here is the relationship of these metrics.</p><ul><li><strong>The higher the confidence level, the longer the test duration.</strong></li><li><strong>The higher the power level, the longer the test duration.</strong></li><li><strong>The smaller the MDE, the longer the test duration.</strong></li></ul><p>The minimum detectable effect is the relative difference we expect from treatment’s outcome to control’s outcome. This is expressed in percentage. The smaller the MDE, the higher the precision, the bigger the sample size, the longer the test duration.</p><p>The power level is the probability of detecting a difference when there is a true difference to be detected. We want a high power level, typically a minimum of 80%, which needs more data samples. When we fail to detect a difference when there is a true difference, a type II error (false negative) has occurred for a lack of samples. The probability of this error is called β. We want to keep this error rate smaller than 20%.</p><p>The confidence level is the the probability the two samples are truly different from each other. We want this probability to be high, at a typical minimum of 90%. When we conclude that the two samples are different but they are actually the same, a type I error (false positive) has occurred. The probability of making this mistake is called ⍺. This is also the probability of the two samples are from the same distribution, commonly known as p-value. We want this to be small. A p-value of 0.05 is typically used.</p><p>For the two examples we have above, the outcomes are both dichotomous measured by a ratio. The sample size can be calculated with this formula</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*RrmAa7Q-kaXhb48ZHjwN2Q.png" /><figcaption>Source: Ref 1</figcaption></figure><p>where ⍺ is the p-value (0.05), β is 1- power level, ES is effect size. A python implementation for power analysis is</p><pre>import numpy as np<br>import pandas as pd<br><br>mde = [i*0.01 for i in range(1, 20, 2)]<br><br>df = pd.DataFrame()<br>df[&#39;mde&#39;] = mde<br>df[&#39;cvr_control&#39;] = [0.04] * len(mde)<br>df[&#39;cvr_test&#39;] = (1+df[&#39;mde&#39;]) * df[&#39;cvr_control&#39;]<br><br><br>def sample_size(df, col1, col2):<br>    pulled_mean = (df[col1] + df[col2])/2<br>    effect_size = abs(df[col1] - df[col2]) / np.sqrt(pulled_mean*(1-pulled_mean))<br>    sample_size = 2 * (1.96 + 0.84)**2  / effect_size**2<br>    return np.ceil(sample_size)<br><br>df[&#39;sample_size_each&#39;] = sample_size(df, &#39;cvr_control&#39;, &#39;cvr_test&#39;)<br><br>df</pre><h3>Stage 3: Result Review</h3><h3>Stage 4: Draw Conclusions</h3><p>Part 2 will include stage 3 and stage 4. To be continued</p><p>Reference:</p><ol><li>Boston University of Public Health <a href="https://sphweb.bumc.bu.edu/otlt/mph-modules/bs/bs704_power/BS704_Power8.html#headingtaglink_5">https://sphweb.bumc.bu.edu/otlt/mph-modules/bs/bs704_power/BS704_Power8.html#headingtaglink_5</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7a76a7a3b56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced SQL — Reshaping Tables]]></title>
            <link>https://kaicui726.medium.com/advanced-sql-reshaping-tables-d80c81e3fd9e?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/d80c81e3fd9e</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Tue, 04 Apr 2023 08:43:51 GMT</pubDate>
            <atom:updated>2023-04-04T08:43:51.855Z</atom:updated>
            <content:encoded><![CDATA[<h3>Advanced SQL — Reshaping Tables</h3><p>Reshaping tables is a crucial aspect of data analysis, and it involves transforming a table from one format to another. Two of the most common ways of reshaping tables are from long to wide and from wide to long. SQL provides a powerful set of tools for performing these transformations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lb7XzIno3hxkYUjhIu1Xdw.jpeg" /><figcaption>Image credit to Unsplash</figcaption></figure><p>In the long format, each row represents a single observation or measurement, and there are typically multiple columns representing different attributes or variables of that observation. In the wide format, each row represents a single unit or entity, and there are multiple columns representing different measurements or attributes of that unit.</p><p>Reshaping tables from long format to wide format or wide format to long format is a highly frequent data manipulation requirement. Knowing the different ways to reshape a table from long2wide or wide2long can be a time saver.</p><h3>Long to Wide</h3><p>Long to wide table transformation involves converting a table with multiple rows per group into a table with a single row per group. This transformation is useful for presenting data in a more compact format, making it easier to compare values across different groups.</p><p>For example, you have a table Client with three columns: name, category, and value. Where category has different attributes such as sports, color, and bonus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*oMacNRqtJid7eIEipOdc-A.png" /></figure><p>You want to reshape the table from long to wide to see each individual’s measurement.</p><pre>select <br>  name, <br>  max(case when category = &#39;sport&#39; then value else null end) as sport, <br>  max(case when category = &#39;color&#39; then value else null end) as color, <br>  max(case when category = &#39;bonus&#39; then value else null end) as bonus<br>from Client<br>group by name</pre><p>The max() function ignores all null values in the expression. Therefore, all values under the same category will be distributed to the according column. This is the result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*ThqYsLULB8jdMEuSXN_WGQ.png" /></figure><h3>Wide to Long</h3><p>Wide to long table transformation involves converting a table with multiple columns per group into a table with multiple rows per group. This transformation is useful for presenting data in a more granular format, making it easier to analyze trends over time or across different categories.</p><p>For instance, you have a wide table with the same columns from last exercise. You want to reshape it from wide to long.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*Yh6qG2HJvhWIoQGO1AzlMQ.png" /></figure><pre>select <br> name, <br> &#39;sport&#39; as category, <br> sport as value<br>from wideClient<br>union all <br>select <br> name, <br> &#39;color&#39; as category, <br> color as value<br>from wideClient<br>union all<br>select <br> name, <br> &#39;bonus&#39; as category, <br> bonus as value <br>from wideClient</pre><p>The union all syntax here concatenate additional rows to the previous table. This is the reshaped long table format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*tFSPIuqAu89BEXKw83Clhg.png" /></figure><h3>Other Solutions</h3><p>Depending on your database, there might be unpivot or pivot functions you can use to reshape the table. The above demonstrated solutions are what I use the most.</p><p>I hope you learned something new about reshaping tables. Leave a comment and let me know what is your go to functions when you reshape tables.</p><p>I am Kai Cui, a humble <a href="http://carbontag.co/">earther</a>. I write about business intelligence and sustainability. Join my network on Linkedin <a href="https://www.linkedin.com/in/cui-kai/">here</a> to get real-time access to my content.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d80c81e3fd9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced SQL — Window Functions & Applications]]></title>
            <link>https://kaicui726.medium.com/advanced-sql-window-functions-applications-bcce1a3ad3ae?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcce1a3ad3ae</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Thu, 16 Mar 2023 15:03:09 GMT</pubDate>
            <atom:updated>2024-11-12T22:24:57.996Z</atom:updated>
            <content:encoded><![CDATA[<h3>Advanced SQL — Window Functions and Applications</h3><p>Window functions in sql can be a quite helpful when you need to manipulate data vertically. We will explore some real business case applications of window functions in this article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oGfo0AHY1ItLWQhirqp-8A.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@mooo3721?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">R Mo</a> on <a href="https://unsplash.com/wallpapers/desktop/windows?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>No matter if you are a data analyst, business intelligence analyst, or data scientist, the ability to connect to databases directly and run analysis by SQL queries is highly desirable if not at all cases required. If you are pursuing a career in any data capacity, it is almost guaranteed that there will an occasion where the data you rely on is not in csv or excel format. It is in some database and requires the secret key, SQL query, to unlock it.</p><p>SQL stands for structured query language. You can also think of it as simple query language. It is very easy to get your hands wet with the basic filtering and grouping functions to get a taste of SQL. In this article, I aim to cover some of the more advanced window functions and its applications in SQL. Let’s dive in.</p><h3>What is window function in SQL</h3><p>A window function in SQL is an aggregation function that produces a new column whose row values are calculated based on the values of one or more rows from the same column. Window functions always have the OVER clause.</p><h3>What are the common window functions in SQL</h3><p>The most common window functions are sum(), count(), lag(), lead(), row_number(), rank(), dense_rank(). You might noticed some of them look familiar as seen in aggregation functions. Remember that window functions are always paired with the OVER clause. If there is no OVER clause, it becomes an aggregation function.</p><h3>Applications of window functions in SQL</h3><h4>Use case 1: calculating running total with sum</h4><p>You have a Users table that contains two columns: day and number of new users. You are asked to find the running total of users for each day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*qeiUx01-OjZjvjIiD7wh-Q.png" /></figure><pre>select <br>  day, <br>  newUsers, <br>  sum(newUsers) over (order by day) as runningTotal<br>from Users</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*CBkEwxuIICLydHKEQEwETg.png" /></figure><h4>Use case 2: finding price spikes with lag and lead</h4><p>You have a Price table that contains two columns: day and stock price. You are asked to find out the days when there is a price spike. A price spike is defined as the price is higher than the previous and following day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*raHoykRbHhFqmJdkHeFrSQ.png" /></figure><pre>with findSpike as (<br>select <br>  day, <br>  price, <br>  lag(price) over (order by day) as prevPrice, <br>  lead(price) over (order by day) as folwPrice<br>from Price) <br><br>select <br>  *, <br>  case when <br>      price &gt; prevPrice and price &gt; folwPrice then &#39;YES&#39; else &#39;NO&#39;<br>  end as isSpike<br>from findSpike </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*fNzgPJlfIUYvXi72mWyy-Q.png" /></figure><h4>Use case 3: finding the top performers within different categories with rank</h4><p>You have a Profit table with three columns: product name, territory, and profit. You are asked to find the top two most profitable products within each territory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*9wVBLWItO1K5tKD90Rql2w.png" /></figure><pre>select <br>  t1.*<br>from<br>(select <br>  productName, <br>  territory, <br>  profit, <br>  rank() over (partition by territory order by profit desc) as rankNum<br>from Profit ) t1<br>where t1.rankNum &lt;= 2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*Ik4yTMvP3ksE-FhXaZyVaQ.png" /></figure><h3>End note</h3><p>Window functions in SQL can be a quite handy tool when you need to manipulate data vertically. There are different parameters in lag(), lead(), and rank() that offers more flexibility on how you can apply the function. Always remember to use OVER on your window functions. I hope these practical examples offered clear demonstrations of applying window functions to do data analysis.</p><p>Leave a comment and let me know what’s your favorite use case of SQL window functions.</p><p>I am Kai Cui, a humble <a href="http://carbontag.co/">earther</a>. I write about business intelligence and sustainability. Join my network on Linkedin <a href="https://www.linkedin.com/in/cui-kai/">here</a> to get real-time access to my content.</p><p>Disclaimer: all data used in this article is synthetic data that does not represent real-world events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcce1a3ad3ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced Data Visualization — Data Animation with Python]]></title>
            <link>https://kaicui726.medium.com/advanced-data-visualization-data-animation-with-python-ecf2289a5913?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecf2289a5913</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[sustainability]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Tue, 07 Mar 2023 18:00:32 GMT</pubDate>
            <atom:updated>2023-03-12T23:08:36.754Z</atom:updated>
            <content:encoded><![CDATA[<h3>Advanced Data Visualization — Data Animation with Python</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yO-v4R68Oy7Fbw9YAjJp-g.jpeg" /><figcaption>Photo credit to NASA</figcaption></figure><p>We are all too familiar with representing time based series of data with a line chart. It is very simple and they are many free tools to draw the line chart with no programming language requirement. You will have a static graph in the end. It is basic data visualization.</p><p>Animating the data at each time stamp takes the visualization to the next level. It brings the story to life by showing how things have evolved over time. Human visions are be default more sensitive to detecting changes. Creating a data animation video gives audience the chance to use this ability and inspire more discoveries.</p><p>I will share my example of how I created the <a href="https://youtu.be/gNOh5Cqr_zg">Major Land Use in the United States</a> data animation using data supplied by US Department of Agriculture and python script by Sjoerd Tilmans in 2 hours.</p><h3>Step 1. Data Collection and Exploration</h3><p>US Department of Agriculture’s website provided a variety of US land use data. All downloadable in csv format. For my purpose of showing how major land use have changed over time, I only needed two dimensions (year, land type) and one metric (land area). After downloading a number of data files and investigating the schemas, I found that the “CSV format of historical data” provided the data I needed. Here is a sample of the csv file. I am quite happy with how clean and organized the data is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Vm_wpU8-F4zgfkHmrHytA.png" /></figure><p>I used a few basic pandas data exploration scripts to form a whole picture of the data.</p><pre>import pandas as pd<br><br>df = pd.read_csv(&#39;MajorLandUse.csv&#39;)<br>df.shape<br>df.columns<br>df.Region.unique()<br>df.Year.unique()</pre><p>Here is a brief summary of the data that I will be using for the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dto1o1wxTEOgyTMq5MeDiA.png" /></figure><h3>Step 2. Data Processing</h3><p>With this clean and structured data, I wrote a few more simple python scripts to create a new data frame with two dimensions and one metric I needed for the data animation.</p><pre>import pandas as pd<br><br>df = pd.read_csv(&#39;MajorLandUse.csv&#39;)<br>  # selecting rows that represent the total land use<br>df1 = df.loc[df[&#39;Region&#39;] == &quot;U.S. total&quot;]<br>  # selecting relevent columns to keep and use Year as the index<br>keep_columns = [&#39;Year&#39;,<br>                &#39;Cropland used for crops&#39;, <br>                &#39;Cropland used for pasture&#39;, <br>                &#39;Cropland idled&#39;, <br>                &#39;Grassland pasture and range&#39;,<br>                &#39;Forest-use land grazed&#39;, <br>                &#39;Forest-use land not grazed&#39;,<br>                &#39;Land in rural transportation facilities&#39;, <br>                &#39;Land in rural parks and wildlife areas&#39;, <br>                &#39;Land in defense and industrial areas&#39;,<br>                &#39;Land in urban areas&#39;<br>               ]<br>df2 = df1[keep_columns].set_index(&#39;Year&#39;)<br>  # export the data frame to an excel file or csv file <br>df2.to_excel(&quot;USLandUse.xlsx&quot;)<br>  # df2.to_csv(&quot;USLandUse.csv&quot;)</pre><p>This is the data after the processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ArTVLP72GY19tEU5tq1c_A.png" /></figure><h3>Step 3. Data Animation</h3><p>Lastly, I followed Sjoerd Tilmans’s data animation tutorial to plug the data into the python script to generate the final result.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FgNOh5Cqr_zg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DgNOh5Cqr_zg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FgNOh5Cqr_zg%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/bcc80fc4241ab5069298a0c98ac0d110/href">https://medium.com/media/bcc80fc4241ab5069298a0c98ac0d110/href</a></iframe><p>Some further thoughts …</p><p>I received some feedback after publishing this data animation video to my Linkedin network and the audience did raise some valid points that I though worth sharing.</p><p>The main argument was that this animated visualization requires the viewers to actually watch the video for a whole minute to receive the same information you can get by a glance of a simpler line chart. I do agree with this. Representing information in different formats and exploring different options are just the beginning steps to derive insights. Sometimes making a more interesting visualization might be a great start to tell the story.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CWZVGwb5EvSjqVtVeyj8ZA.png" /></figure><p>I hope you have learnt something new about data analytics and visualization with python. Leave a comment and let me know what pros and cons you think about this animation.</p><p>I am Kai Cui, a humble <a href="http://carbontag.co/">earther</a>. I write about business intelligence and sustainability. Join my network on Linkedin <a href="https://www.linkedin.com/in/cui-kai/">here</a> to get real-time access to my content.</p><p>Reference:</p><ol><li>Data Source: U.S. DEPARTMENT OF AGRICULTURE: Economic Research Service <a href="https://www.ers.usda.gov/data-products/major-land-uses/">https://www.ers.usda.gov/data-products/major-land-uses/</a></li><li>Data Animation: Sjoerd Tilmans <a href="https://www.sjdataviz.com/software">https://www.sjdataviz.com/software</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecf2289a5913" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Digital Analytics — What does Medium, Source, and Channel mean in Google Analytics]]></title>
            <link>https://kaicui726.medium.com/what-does-medium-source-and-channel-mean-in-google-analytics-ce0c7acdead8?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce0c7acdead8</guid>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Mon, 06 Mar 2023 12:12:11 GMT</pubDate>
            <atom:updated>2023-11-13T07:41:59.347Z</atom:updated>
            <content:encoded><![CDATA[<p>Understand how Google Analytics defines medium, source, and channel to correctly interpret user acquisition reports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1vHUdcKxOEtyWY2U.jpeg" /><figcaption>Image credit to Unsplash</figcaption></figure><p>Google Analytics is a power house when it comes to user online behavior collection and reporting. Linking your Google Analytics account with Google Ads account offers even greater visibility of how different campaigns perform against particular goals. It offers insights backed by data to help marketers create a loyal and highly-engaged audience. Deriving insights and actionable intelligence from Google Analytics reports requires accurate understanding and correct interpretation of the data.</p><p>This article explains different dimensions of user acquisition in Google Analytics with real reports as examples.</p><h3>Medium</h3><p>As defined by Google, medium is the mechanism that delivered users to your site. Common examples of medium are:</p><ul><li>organic: traffic to site from unpaid search, such as non-paid Google search</li><li>cpc: (cost per click) traffic to site from paid search, such as Google Ads text ads</li><li>referral: traffic to site from another website other than a search engine, such as affiliates</li><li>email: traffic to site from tracked email marketing campaign</li><li>none: traffic to site from typing URL directly to browser</li></ul><h3>Source</h3><p>Source can be seen a secondary dimension to medium, which provides more detailed information about the medium. Common seen values of source are:</p><ul><li>direct, when medium is none</li><li>URL when medium is referral</li><li>Google, Bing, when medium is organic</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/0*y5mX27f9R7mF7DnX.png" /><figcaption>Google Analytics Source / Medium Traffic Report</figcaption></figure><h3><strong>Channel</strong></h3><p>Channel is a combination of source and medium. Traffics are automatically grouped into basic categories (aka channels) like Organic, Social, Direct, Referral, Display, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jbgSWgkuHvDjNB5s.png" /><figcaption>Google Analytics User Acquisition Channel Report with Default Grouping</figcaption></figure><p>Hope this is helpful in getting you started to understand different traffic to your website. These default value can be customized as well to best suit your business needs with UTM tagging. In the future articles, I will share the details of how to do that.</p><p>I am Kai Cui, founder of <a href="http://carbontag.co/">carbontag.co</a></p><p>I write about business intelligence and sustainability. Join my network on Linkedin <a href="https://www.linkedin.com/in/cui-kai/">here</a> to get the first access to my content.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce0c7acdead8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sustainable Fashion — Top 3 Fresh Takes from the Largest Textile Fair in the UK 2023]]></title>
            <link>https://kaicui726.medium.com/kai-cui-top-3-fresh-takes-from-the-largest-textile-fair-in-the-uk-2023-549a7d51b5de?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/549a7d51b5de</guid>
            <category><![CDATA[sustainability]]></category>
            <category><![CDATA[fashion]]></category>
            <category><![CDATA[textile]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Sat, 21 Jan 2023 15:40:54 GMT</pubDate>
            <atom:updated>2023-04-04T09:55:33.833Z</atom:updated>
            <content:encoded><![CDATA[<p>The London Textile Fair took place in the Business Design Center on Jan 10 and 11th. It has attracted over 500 textile exhibitors and thousands of visitors across England, Wales, Ireland, Portugal, Turkey, and China.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jd2hw92X_UOHaox5BbWKPg.jpeg" /><figcaption>Image supplied by Kai Cui</figcaption></figure><p>The London Textile Fair’s entrance featured a special exhibition by BDA London showcasing the forecasted textile trend in the fashion industry for Spring/Summer 2024. A special seminar on color, fabric, and texture trend was also offered by Gwyneth Holland, the senior lecturer on fashion and trend from the University of Westminster. Gwyneth shared her perspective on the future — protopia, a state that each day is a bit better than the day before. Textile agents and fashion trend forecasters were also at the fair to shared their observations with the latest market demand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*buIDECjc8XZbe4ol0fqvfA.png" /><figcaption>Image supplied by Kai Cui</figcaption></figure><p>Here are the top 3 takeaways from the London Textile Fair 2023.</p><ol><li>Sustainability becomes the biggest market shift in this year’s show. The global pandemic and frequent extreme weathers has made more of us aware of the climate crisis and rethink about the way we live within the nature’s eco-system. According to Jack Moulson, the Sales Manager at the Urban Fabrics Agency, “Sustainability and transparency with the supply chain, from raw material to end product, is becoming more and more of a demand.” Exhibitors are witnessing an increased interests on natural and sustainable fabrics, especially certified organic and recycled textiles.</li><li>Building a connected community is the winning strategy for brands to attract and retain younger customers. As Gen-Z entering the main stage, they reject the harmful norms and create their own path to innovation and self-expression. Grassroots brands focusing on sustainability, transparency, and ethical values enjoyed tremendous growth as consumers looking for connections with the people who made their garments.</li><li>Incorporating technology into brand’s experience that fosters well-being is the source of growth. With tech giants like Meta doubling down on metaverse, more brands are exploring revenue streams from NFTs and digital wearables. With hardwares innovations supporting more advanced Augmented Reality and Virtual Reality, brands that can offer a virtual experience that builds connections and foster personal well-being will be the magnate.</li></ol><p>I am Kai Cui, founder of carbontag.co, the first carbon emission calculator for consumer fashion products. I write about fashion technology and sustainability. Find me on Linkedin at <a href="https://www.linkedin.com/in/cui-kai/">https://www.linkedin.com/in/cui-kai/</a></p><p>This article is originally published on fashioncapitcal.co.uk</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=549a7d51b5de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sustainable Fashion — A Practical Responsible Consumption Guide for Fashion Lovers]]></title>
            <link>https://kaicui726.medium.com/a-practical-responsible-consumption-guide-for-fashion-lovers-c615b408a486?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/c615b408a486</guid>
            <category><![CDATA[sustainability]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[fashion]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Thu, 12 Jan 2023 17:37:39 GMT</pubDate>
            <atom:updated>2023-04-04T09:56:46.689Z</atom:updated>
            <content:encoded><![CDATA[<p>We all have heard so much about the huge negative impact the fashion industry has on our environment. Being the second biggest greenhouse gas emitter, the fashion industry has a long way to go towards sustainability. On the bright side, there are already designer incorporating zero-waste and circularity into their garment design, brands participating in carbon capture projects to reduce their emission, and manufacturers innovating new approaches to recycle fabrics. Needless to day, all the players along the value chain need to do their part to make the garment industry green and clean, including the shoppers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*D52fHAZavj924MlqNuPoCA.png" /><figcaption>Poster from the United Nations’ SDG Website</figcaption></figure><p>One of the United Nation’s sustainable development goals is responsible consumption and production, which is essentially saying that we have too much overconsumption and overproduction to a point that it is not sustainable. The Clothing Sustainability Research Group led by Professor Tim Cooper from Nottingham Trent University discovered that people in average own 115 items of clothing, 30% of which have not been worn during the past year. These numbers are from 2018. I can only imagine how much they have increased over the past five years.</p><p>The influence of fast fashion combined with social media created this illusional fear of missing out on the latest trend. This toxic consumerism culture is damaging our planet as well as our younger generation’s mental health. So what are the some of the practical ways for individual shoppers to play their part in responsible consumption?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SSWc_V2AeAVXaxSKjfWxSQ.png" /><figcaption>Poster from Carbon Tag (carbontag.co)</figcaption></figure><p>Here are my four practical S.T.A.R. steps for you to become a responsible consumer.</p><p>Step 1: Choose <strong>Style, </strong>not trend. As Coco Chanel said, “Fashion is ephemeral, but style is eternal.” Star by regularly reviewing all the clothings you have in the wardrobe and collecting inspirational looks to your style board. This will help you make more rational purchase instead of driven by impulse. Overtime you will be proud of yourself for investing the time and effort to discover your unique style that no trend can match.</p><p>Step 2: <strong>Teach</strong> yourself about sustainable fashion. With many brands trying to catch on the green trend and make profit off it, you can’t give all your trust to what the brand says. To avoid getting green washed, you need to proactively learn and teach yourself about sustainability and what it means to you. It could be favoring natural fiber over synthetic fiber. It could be choosing indie designers over mass-produced looks. There are many resources available online. Carbon Tag is the first carbon emission calculator that gives you an estimate of the greenhouse gas emissions of a garment based on fabric composition, manufacturing country, and garment type. Give it a try at <a href="https://app.carbontag.co./">https://app.carbontag.co</a></p><p>Step 3: <strong>Advocate</strong> for responsible consumption and sustainable fashion. It’s hard to make a difference with one person, but collectively real change can happen. Talk about sustainable fashion with your family and friends, participate in the “Who Made My Clothes” movement, and support your local community’s sustainability proposal. When there is enough awareness, there will be more participation.</p><p>Step 4: <strong>Reuse, repurpose,</strong> and <strong>recycle</strong> as much as you can at the product’s life end. With a little bit of creativity, you will be surprised to find many second life opportunities for your pre-loved clothings. Donating them to the charity; having them altered for a new look; and reusing the fabrics for art and craft projects. There are much more you can do before they end up in the landfill.</p><p>I am Kai Cui, founder of carbontag.co, the first carbon emission calculator for consumer fashion products. I am a fashion sustainability consultant and data scientist.</p><p>Find me on Linkedin at <a href="https://www.linkedin.com/in/cui-kai/">https://www.linkedin.com/in/cui-kai/</a></p><p>Reference:</p><ol><li>Sustainability of the fashion industry inquiry: Written evidence submitted by Professor Tim Cooper, Clothing Sustainability Research Group, Nottingham Trent University</li><li>A Deep Dive into H&amp;M Conscious Choice by Kai Cui, founder of Carbon Tag <a href="https://medium.com/@kaicui96/a-deep-dive-into-h-ms-conscious-choice-4af6780cfdd9">https://medium.com/@kaicui96/a-deep-dive-into-h-ms-conscious-choice-4af6780cfdd9</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c615b408a486" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Deep Dive into H&M’s Conscious Choice]]></title>
            <link>https://kaicui726.medium.com/a-deep-dive-into-h-ms-conscious-choice-4af6780cfdd9?source=rss-b861f53dea66------2</link>
            <guid isPermaLink="false">https://medium.com/p/4af6780cfdd9</guid>
            <category><![CDATA[greenwashing]]></category>
            <category><![CDATA[fashion]]></category>
            <category><![CDATA[sustainability]]></category>
            <dc:creator><![CDATA[Kai Cui - Senior Data Scientist]]></dc:creator>
            <pubDate>Tue, 13 Dec 2022 14:18:20 GMT</pubDate>
            <atom:updated>2023-04-04T09:56:18.326Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sustainable Fashion — A Deep Dive into H&amp;M’s Conscious Choice</h3><h4>H&amp;M sued for greenwashing claims, again — FashionUnited.uk</h4><p>Is recycled polyester REALLY more sustainable compared to conventional polyester? This is the question needs to be answered to determine if H&amp;M is “misleadingly, illegally, and deceptively” seeking to capitalize on consumer ‘green’ trends by greenwashing its audiences.</p><p>As a fashion data scientist, I searched for data sources online and visited one H&amp;M store in London’s most affluent neighborhood — — Kensington High Street to look for answers. Here is what I found.</p><p><strong>Recycled polyester is as unsustainable as conventional polyester. There is almost no environmental benefits for choosing recycled polyester.</strong></p><p>As a manufactured synthetic fiber, polyester is a kind of plastic and is usually derived from petroleum, which is the conventional production method. Alternatives to oil-derived polyester are made from recycled plastic, agricultural crops, or even waste, which is the recycled production method. The graph below demonstrates the greenhouse gas (GHG) emissions in kilogram to produce one kilogram of polyester by recycled and conventional approach in different countries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MOFPS_QkQTGugzb9le-XoQ.png" /><figcaption>Image from Carbon Tag</figcaption></figure><p>With this knowledge in mind, photos I have taken during my visit to the H&amp;M’s store on Kensington High Street completes a classic greenwashing campaign.</p><p>H&amp;M’s “Conscious Choice” products have a green hangtag that suggests garments are either sustainable or more sustainable than other products. Here is picture directly from H&amp;M website about their “Conscious Choice”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I6S_XJCt_14QFMJTthAb9A.png" /><figcaption>Image from H&amp;M</figcaption></figure><p>Here are some samples of H&amp;M’s “Conscious Choice” products.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W8kmrcJcA0DwPMoJKsYlrg.jpeg" /><figcaption>Image from author</figcaption></figure><p>The beige women’s long coat on the left has a green hangtag saying the shell is made from 50% recycled polyester and the lining is 100% polyester. The caring label says the shell is 90% polyester and the lining is 100% polyester. The plaid men’s jacket on the right is 100% polyester with 50% of it from recycled polyester. With the material intensity facts in mind, we can reach the conclusion that there is effectively no environmental benefits for choosing H&amp;M’s “Conscious Choice” products.</p><p>The process and result I just walked you through in 2 minutes took me 10 hours to collect, analyze and present. It is not expected for everyone wanted to choose consciously go through this lengthy process to avoid getting green washed. Brands and marketers use general public’s desire to be green and lack of information to determine what is green to manipulate and mislead customers into believing a product is more sustainable than it actually is, is called GREENWASHING. And I am SICK of it.</p><p>Knowledge of the environmental price we pay for consuming products needs to be <strong>democratized</strong>. That’s why I choose to build Carbon Tag. It’s the first carbon emission estimator for consumer fashion products. It empowers people with the information they needed to live an eco-friendly lifestyle by demystifying carbon footprint of everyday products. And it’s super easy to use. Give it a try at <a href="http://app.carbontag.co/">app.carbontag.co</a></p><p>If you find this article insightful, please spread the message and join my journey to empower people!</p><p>I am Kai Cui, founder of carbontag.co, the first carbon emission calculator for consumer fashion products. Find me on Linkedin at <a href="https://www.linkedin.com/in/cui-kai/">https://www.linkedin.com/in/cui-kai/</a></p><p>Reference:</p><ul><li><a href="https://fashionunited.uk/news/fashion/h-m-sued-for-greenwashing-claims-again/2022111466226">H&amp;M sued for greenwashing claims, again</a></li><li><a href="https://kering-group.opendatasoft.com/pages/material-intensities-2021/">Material Intensities 2021 - Kering</a></li><li><a href="https://www2.hm.com/en_gb/sustainability-at-hm/our-products/explained.html">Conscious choice explained | H&amp;M</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4af6780cfdd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>