<?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 Xikai Zhao on Medium]]></title>
        <description><![CDATA[Stories by Xikai Zhao on Medium]]></description>
        <link>https://medium.com/@kailovesdata?source=rss-bd48e5c52d1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xTLW5t0B_kXiVaC04kgWKA.png</url>
            <title>Stories by Xikai Zhao on Medium</title>
            <link>https://medium.com/@kailovesdata?source=rss-bd48e5c52d1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 00:51:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kailovesdata/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[Using causal inference to measure business impact after program launch]]></title>
            <link>https://medium.com/data-science-at-microsoft/using-causal-inference-to-measure-business-impact-after-program-launch-d8361bfeee71?source=rss-bd48e5c52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8361bfeee71</guid>
            <category><![CDATA[experiment]]></category>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[experimentation]]></category>
            <category><![CDATA[causal-inference]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Xikai Zhao]]></dc:creator>
            <pubDate>Tue, 07 May 2024 07:16:57 GMT</pubDate>
            <atom:updated>2024-05-14T18:24:06.095Z</atom:updated>
            <content:encoded><![CDATA[<h4>Alternatives for when experimentation is not possible</h4><p><em>Lead Author: </em><a href="https://www.linkedin.com/in/xikai/"><em>Xikai Zhao</em></a><em><br>Contributors: </em><a href="https://www.linkedin.com/in/jyoti-patil-7aaa9312/"><em>Jyoti Patil</em></a><em>, </em><a href="https://www.linkedin.com/in/abhishek-gupta-71392a18/"><em>Abhishek Gupta</em></a><em>, </em><a href="https://www.linkedin.com/in/wgalczak/"><em>Anthony Galczak</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nZb7BpnOZKQ2HPKC" /><figcaption>Photo by <a href="https://unsplash.com/@jdiegoph?utm_source=medium&amp;utm_medium=referral">Diego PH</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>.</figcaption></figure><h3>What is causal inference?</h3><p>Causal inference is the study of cause-and-effect relationships. Causal inference involves asking questions such as “Does X cause Y?” and “What are the effects of changing X on Y?”</p><p><strong>Correlation is not always causation</strong>. For example, ice cream sales is correlated with drowning incidents, but it’s actually hot weather causing both to increase. Unlike methods that are concerned only with associations or correlations, causal inference methods tend to answer the question of why Y changes. In other words, if X is causally related with Y, then Y’s change can be explained in terms of X’s change.</p><p>Causality allows us to reason about the world and plays an integral role in all forms of decision making. Although it’s essential to business decisions, it’s often difficult to determine. If we lower prices, will sales increase? (The answer is sometimes no.) If we impose a fine on parents who are late picking up their children from daycare, will lateness decrease? Surprisingly, the answer may be no; lateness may be likely to increase.</p><p>Causality is essential in medicine: For example, will a new drug reduce the size of cancer tumors? (That’s why medical trials exist.) This kind of reasoning involves imagination: We need to be able to imagine what will happen if we do X, as well as if we don’t do X. When used correctly, data allows us to infer something about the future based on what happened in the past. And when used incorrectly, we merely repeat the same mistakes we’ve already made.</p><p>Causal inference also enables us to design interventions: If we understand why a customer is making certain decisions, such as churning, their reason for doing so will have a significant impact on the success of our intervention.</p><h3>Why use causal inference?</h3><p>Causal inference is a method for determining the causal effect of a treatment, such as launching a program for certain customers, without conducting an experiment. Because the program in our example had already been launched worldwide, experimentation was not possible, making causal inference stand out as an alternative approach. We also considered other methods, such as comparing the period before and after the program launch by looking at KPI trends in 2022. However, the KPI trends approach is subject to seasonal bias and so may not yield accurate results. Causal inference, in contrast, aims to eliminate other biases and isolate the causal impact that results from the program launch.</p><h3>Causal inference methods we evaluated</h3><p>Of the four causal inference methods we evaluated, we picked Diff-in-Diff (DID) and Synthetic Diff-in-Diff. We weren’t able to use Synthetic Control mainly because there weren’t enough segments that didn’t receive treatment. Double Machine Learning also wasn’t suitable because we didn’t have enough confounder variables.</p><h4>Difference-in-Difference</h4><p>The Diff-in-Diff method is an approach commonly used in causal inference that involves comparing changes in outcomes over time between two groups, one of which is treated with an intervention and one of which is not. The method attempts to estimate the causal effect of the intervention by controlling for pre-existing differences between the two groups and using the changes over time to isolate the effect of the intervention. The basic idea of the DID method is to compare the difference in outcomes before and after the intervention for the treated group with the difference in outcomes over the same time period for the control group. By subtracting the change in the control group from the change in the treated group, researchers can estimate the causal effect of the intervention, assuming that any other factors that could have affected the outcomes in the two groups are constant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNzz3G4XUEytl1RwWfEPeg.png" /><figcaption>Source: <a href="https://www.publichealth.columbia.edu/research/population-health-methods/difference-difference-estimation">https://www.publichealth.columbia.edu/research/population-health-methods/difference-difference-estimation</a></figcaption></figure><h4><strong>Assumptions</strong></h4><p>In order to estimate any causal effect, three assumptions must hold: exchangeability, positivity, and the Stable Unit Treatment Value Assumption (SUTVA). DID estimation also requires that:</p><ul><li>The intervention is unrelated to the outcome at baseline (i.e., the allocation of intervention was not determined by the outcome).</li><li>The treatment/intervention and control groups have parallel trends in the outcome (see below for details).</li><li>The composition of intervention and comparison groups is stable for repeated cross-sectional design (part of SUTVA).</li><li>No spillover effects (part of SUTVA).</li></ul><p><strong>Parallel trend assumption</strong> <br>The parallel trend assumption is the most critical of the four assumptions above to ensure internal validity of DID models and is the hardest to fulfill. It requires that in the absence of treatment, the difference between the “treatment” group and the “control” group is constant over time. Although there is no statistical test for this assumption, visual inspection is useful when you have observations over many time points. It has also been proposed that the smaller the time period tested, the more likely the assumption is to hold. Violation of the parallel trend assumption leads to biased estimation of the causal effect.</p><p><strong>Strengths and limitations</strong></p><p><em>Strengths</em></p><ul><li>Intuitive interpretation</li><li>Possible to obtain causal effect using observational data if assumptions are met</li><li>Possible to use either individual- or group-level data</li><li>Comparison groups can start at different levels of the outcome (DID focuses on change rather than absolute levels)</li><li>Accounts for change due to factors other than intervention</li></ul><p><em>Limitations</em></p><ul><li>Requires baseline data and a non-intervention group</li><li>Cannot use if intervention allocation is determined by baseline outcome</li><li>Cannot use if comparison groups have different outcome trends</li><li>Cannot use if composition of groups pre-/post-change are not stable</li></ul><h4>Synthetic Control</h4><p>Synthetic Control is particularly useful in situations where the treatment was applied only to a single unit (such as a country or a city) and there is no comparable control group. The Synthetic Control Method (SCM) creates a “synthetic” control group by combining multiple control units that share similar pre-treatment characteristics with the treated unit. The method generates a weighted average of these units to create a synthetic control group that mimics the treated unit’s pre-treatment outcomes as closely as possible. The difference between the actual outcome of the treated unit and the outcome predicted by the synthetic control group is then used to estimate the causal effect of the treatment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*PKVEilGAOOrgZMXiiCmEwg.png" /><figcaption>Source: <a href="https://www.summitllc.us/synthetic-control-method">https://www.summitllc.us/synthetic-control-method</a></figcaption></figure><h4>Synthetic Difference-in-Difference (SDID)</h4><p>This is similar to Synthetic Control. Synthetic Diff-Diff (SDID) creates a counterfactual world. However, the major difference is that SDID allows for an intercept and adds an <a href="https://en.wikipedia.org/wiki/Regularization_(mathematics)">L2 penalty term</a>.</p><p>The intercept represents the fact that the goal of <em>ω</em> is no longer to perfectly match the treatment group, but only to mimic the trend of the treatment group. Even if we don’t get a perfect match, we can correct it later with unit fixed effect (an aspect of DID).</p><p>In addition, by imposing the L2 penalty, SDID tries to avoid extreme concentrations of weight in some donor pools and stabilize the estimation.</p><h4>Double Machine Learning</h4><p>Double Machine Learning is a method for causal inference that combines Machine Learning techniques with a propensity score weighting approach to estimate treatment effects.</p><p>The basic idea behind Double Machine Learning is to use two separate Machine Learning algorithms to estimate the outcome and treatment models. The first Machine Learning algorithm, called the “outcome model,” is used to estimate the conditional expectation of the outcome variable given the covariates (variables that affect a response variable, but are not of interest in a study). The second Machine Learning algorithm, called the “treatment model,” is used to estimate the propensity score, which is the probability of receiving the treatment given the covariates.</p><p>The estimated propensity scores are then used to weigh the observations, with the goal of creating a pseudo-population in which the covariate distributions are balanced between the treatment and control groups. This weighting can reduce bias in the estimation of the treatment effect.</p><p>Finally, the outcome model is re-estimated using the weighted data, and the treatment effect is calculated as the difference between the conditional expectations of the outcome variable in the treated and control groups.</p><p>The Double Machine Learning approach has been shown to have several advantages over traditional methods for estimating treatment effects, including improved robustness to model mis-specification and higher efficiency in finite samples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vJ5xK9cqbkitExfi43MYUQ.png" /><figcaption>Source: <a href="https://www.youtube.com/watch?v=zQk13PVYMUs&amp;t=303s&amp;ab_channel=BradyNeal-CausalInference">Doubly Robust Methods, Matching, Double Machine Learning, and Causal Trees</a> by Brady Neal on YouTube.</figcaption></figure><h3>Conclusion</h3><p>While A/B experiments remain the gold standard for measuring causality, causal inference complements A/B in cases where experiments aren’t feasible. For instance, when introducing Generative AI products, we sometimes prioritize speedy launches without A/B experiments. Even in such cases, we can leverage causal inference to gauge the business impact without the need to endure months of experimentation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8361bfeee71" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science-at-microsoft/using-causal-inference-to-measure-business-impact-after-program-launch-d8361bfeee71">Using causal inference to measure business impact after program launch</a> was originally published in <a href="https://medium.com/data-science-at-microsoft">Data Science + AI at Microsoft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sentiment Analysis Series 1]]></title>
            <link>https://engineering.ziffmedia.com/sentiment-analysis-series-1-15-min-reading-b807db860917?source=rss-bd48e5c52d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b807db860917</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[obama]]></category>
            <dc:creator><![CDATA[Xikai Zhao]]></dc:creator>
            <pubDate>Fri, 11 Aug 2017 22:50:21 GMT</pubDate>
            <atom:updated>2017-10-18T18:05:48.869Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Sentiment Analysis?</h3><p>Sentiment analysis (also known as opinion mining or emotion AI) is essentially the process of determining the emotional tone behind a series of words, used to gain an understanding of the attitudes, opinions and emotions expressed within an online mention.</p><h3>Why should I care about it?</h3><p>The applications of sentiment analysis are endless and extremely powerful!</p><p>The Obama administration used sentiment analysis to gauge public opinion to policy announcements and campaign messages ahead of the 2012 presidential election.</p><p>Companies monitor social media to track customer reviews, survey responses and competitors. The finance industry uses it to predict stock prices by understanding customers’ sentiment toward certain brands.</p><p>Sentiment analysis is in demand because of its efficiency. Thousands of text documents can be processed for sentiment (and other features, including named entities, topics, themes, etc.) in seconds, compared to the hours it would take a team of people to manually complete.</p><h3>What is the magic behind it?</h3><p>There is no magic. It’s math and statistics. In this case, it’s Naive Bayes classifier.</p><h3>What is Naive Bayes Classification?</h3><p><a href="https://en.wikipedia.org/wiki/Naive_Bayes_classifier">Naive Bayes Classification</a> is a family of algorithms based on a common principle. All Naive Bayes classifiers assume that the value of a particular feature is <a href="https://en.wikipedia.org/wiki/Independence_(probability_theory)">independent</a> of the value of any other feature, given the class variable.</p><h3>Why is it called “Naive”?</h3><p>As explained above, all Naive Bayes are based on the independent feature assumption. Despite their naive design and apparently oversimplified assumptions, Naive Bayes classifiers have worked quite well in many complex real-world situations.</p><h3>Efficient and highly scalable</h3><p><a href="https://en.wikipedia.org/wiki/Maximum-likelihood_estimation">Maximum-likelihood</a> training can be done by evaluating a <a href="https://en.wikipedia.org/wiki/Closed-form_expression">closed-form expression</a>, which takes <a href="https://en.wikipedia.org/wiki/Linear_time">linear time</a>, rather than by expensive <a href="https://en.wikipedia.org/wiki/Iterative_method">iterative approximation</a> as used for many other types of classifiers.</p><p>Abstractly, Naive Bayes is a <a href="https://en.wikipedia.org/wiki/Conditional_probability">conditional probability</a> model: Given a problem instance to be classified, represented by a vector x=(x1,….xn) representing some n features (independent variables), it assigns to this instance probabilities for each of k possible outcomes or classes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*zHSQOuLT5BwBVud5StsBeg.png" /></figure><p>This can be translated into English:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*ehKSG8bZGKb2BbdZg8BWFw.png" /></figure><h3>Multinomial Naive Bayes</h3><p>With a multinomial event model, samples (feature vectors) represent the frequencies with which certain events have been generated by a <a href="https://en.wikipedia.org/wiki/Multinomial_distribution">multinomial</a> (p1, p2…. pn) where pi is the probability that event i occurs (or K such multinomials in the multiclass case).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*xCrFVC4qybkx7ZyJV_RZ3g.png" /></figure><h3>Bernoulli Naive Bayes</h3><p>In the multivariate <a href="https://en.wikipedia.org/wiki/Bernoulli_distribution">Bernoulli</a> event model, features are independent <a href="https://en.wikipedia.org/wiki/Boolean_data_type">booleans</a> (binary variables) describing inputs. Like the multinomial model, this model is popular for document classification tasks, where binary term occurrence features are used rather than term frequencies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*9DMVvHVdK-UwehuLwZyL7g.png" /></figure><h3>Preparation</h3><p>The model is based on a simple model from this blog on <a href="http://streamhacker.com/2010/05/10/text-classification-sentiment-analysis-naive-bayes-classifier/">sentiment analysis</a> as a starting point. In the model, I use a <a href="http://www.nltk.org/book/ch02.html">movie review corpus</a> from NLTK with reviewed categorized into two categories: positive reviews and negative reviews. I simply started with three simple Naive Bayes classifiers as a baseline, with boolean word as feature extraction. Then evaluate the model based on their accuracy, recall and precision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ndodnQzCpPZwIH-aJeffA.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href">https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href</a></iframe><h3>Word feature extraction</h3><p>I extracted word features as the training set. For this problem, I used a simplified <a href="https://en.wikipedia.org/wiki/Bag-of-words_model">bag-of-words</a> model and mapped individual word (feature name) to a boolean value (feature value).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href">https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href</a></iframe><h3>Training</h3><p>Three quarters of total records, or 1,500 records, were used as the <a href="https://en.wikipedia.org/wiki/Test_set">training set</a>, and another 500 records was used as the testing set to evaluate the model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href">https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href</a></iframe><h3>Naive Bayes classifier</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href">https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href</a></iframe><h3>Multinomial Naive Bayes</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/997c8417a0211994d777ae5bcaa35148/href">https://medium.com/media/997c8417a0211994d777ae5bcaa35148/href</a></iframe><h3>Bernoulli Naive Bayes classifier</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href">https://medium.com/media/dc52d6af9993b053c90ea7dae7214b3a/href</a></iframe><h3>Evaluation and conclusion</h3><p>For evaluation, I used accuracy as the core metric to evaluate the model. In addition, <a href="https://en.wikipedia.org/wiki/Precision_and_recall">precision and recall</a> are also used, as they provide great insights on biases.</p><p>The results are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*0OwX3rZt1VznXcBQoDjIMQ.png" /></figure><p>As seen, Multinomial Naive Bayes and Bernoulli Naive Bayes performed significantly better than the regular Naive Bayes, with an accuracy of about 80. I am quite amazed by this result considering human sentiment analysis accuracy is around 80 percent too. It’s also surprising that “avoids” is one of the top most informative features.</p><p>According to the precision and recall, 98% positive reviews are identified by the model. On the other hand, 96% of selected negative reviews are correct.</p><h3>Flaws and next steps</h3><ol><li>I didn’t filter out <a href="https://en.wikipedia.org/wiki/Stop_words">stop words</a> for this model, and it’s a good practice, in general, to remove noise like stop words.</li><li>This model is using the <a href="https://en.wikipedia.org/wiki/Bag-of-words_model">bag-of-words model</a>, and it treats each word as an individual object. Bag-of-words ignores the context of words. It can fail badly in some specific cases. For example: “Not bad” doesn’t not-equal-to “bad.” I will apply N<a href="https://en.wikipedia.org/wiki/Bag-of-words_model">-gram model</a> in the next version.</li><li>For the word features, it used a boolean value as feature values. I am interested in using term frequencies along with <a href="https://en.wikipedia.org/wiki/Tf%E2%80%93idf">TF-IDF</a> to see how the model performs.</li><li>In addition, I plan to create a hybrid model that consists of all the models, having each model vote and take the majority votes as the result, which might improve the accuracy as well.</li><li>Eventually, I plan to extract social media newsfeeds (Twitter for example) and apply this model to get an idea of people’s opinions.</li></ol><p>References：</p><ul><li><a href="http://streamhacker.com/2010/05/24/text-classification-sentiment-analysis-stopwords-collocations/">http://streamhacker.com/2010/05/24/text-classification-sentiment-analysis-stopwords-collocations/</a></li><li><a href="https://en.wikipedia.org/wiki/Naive_Bayes_classifier">https://en.wikipedia.org/wiki/Naive_Bayes_classifier</a></li><li><a href="https://www.brandwatch.com/blog/understanding-sentiment-analysis/">https://www.brandwatch.com/blog/understanding-sentiment-analysis/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b807db860917" width="1" height="1" alt=""><hr><p><a href="https://engineering.ziffmedia.com/sentiment-analysis-series-1-15-min-reading-b807db860917">Sentiment Analysis Series 1</a> was originally published in <a href="https://engineering.ziffmedia.com/">Ziff Media Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>