tag:blogger.com,1999:blog-24706386623823121512017-11-17T01:32:52.543+09:00Ill-Identified Blog (English)This blog is for my own English language training<br>
My Japanese Blog: <a href="http://ill-identified.hatenablog.com/">http://ill-identified.hatenablog.com/</a>Satoshi KATAGIRInoreply@blogger.comBlogger1125tag:blogger.com,1999:blog-2470638662382312151.post-64628180594985208772017-10-21T14:44:00.000+09:002017-11-17T01:32:52.554+09:00Bad Practices of Data Science<h1 id="description">Description</h1><ul><li>This article targets nonprofessionals or the beginners who are not familiar to the data science<a class="footnote" href="https://en-ill-identified.blogspot.jp/2017/10/bad-practices-of-data-science.html#fn:datascience" id="fnref:datascience" title="See footnote">1</a>.</li><li>I explain the common mistakes on data-analyzing for nonprofessionals, not to be deceived by wrong data-analyzing reports and for beginners not to acquire bad knowledge.</li><li>I wrote this article as my English language training.</li></ul>Some years have passed since the data science, big data, or other words occurred. Nowadays a lot of information about data science is found on the internet and books; statistical inference, causal inference, Bayesian statistics, machine learning, deep learning and Artificial Intellectual. Many people want to learn the data science on his own, and many companies employ the data scientists or ask the data science consultants for analyzing their own data.<br /><br />However, it is hard and takes much time to understand data science methodologies deeply, so you may <strong>misuse</strong> the data science methods even without malice, and someone may <strong>abuse</strong> that with malice. You also may be deceived by malicious someone who abuse the data science methods.<br /><br />Hence, in this article, I described what is the bad data science practice, and what is the not-bad one. I wrote this article targeting the nonprofessionals who ask the data scientists or data science consultants for analyzing his company’s data. But I also recommend reading this article for those who start to learn the data science, and for those who are using any analytics software yet don’t know theoretical foundations.<br /><br />The examples of misuses in this articles are from my private/work experience. But I did not write what had actually happened and modified the details, so I did not meant to disparage any person or any organization. I did wrote this article to hope in my very soul that <strong>the right data science methodologies spread and contribute to human society</strong>.<br /><br />This article consists of 4 sections: Section 1 is the description. In section 2, I briefly explain the fundamental concept of “analysis.” In section 3, I describe three examples of bad data analyzing and prescription for it. Section 4 is summary and conclusions of this article.<br /><h1 id="what-is-the-analysis">What Is the Analysis</h1>At first, we need to clarify the meaning of the word “analysis.” A dictionary says the word “analysis” means the followings:<br /><blockquote><ol><li>the separating of any material or abstract entity into its constituent elements (opposed to synthesis ).</li><li>this process as a method of studying the nature of something or of determining its essential features and their relations: the grammatical analysis of a sentence.</li><li>a presentation, usually in writing, of the results of this process: The paper published an analysis of the political situation. <br /> <a href="http://www.dictionary.com/browse/analysis">http://www.dictionary.com/browse/analysis</a></li></ol></blockquote>However, my definition of “analysis” is different from the above. In my thought, these definitions refer the concept of “deduction.” My definition of “analysis” is much closer to the concept of “abduction” or “retroduction,” which is introduced by C. S. Peirce than the above definitions. Briefly, I state the definition of the analysis (you must be bored with such abstract and non-practical discussion):<br /><blockquote>the process of creating hypothesis and validating it, or repeat of this process some times.</blockquote>In the context of data science (empirical science), It is impossible to separate strictly the problem into constituent elements because the data contains any inseparable error/noise components arising by any reason. Analysis which is in the lexical meaning is suitable for noiseless formal logical or thought experimental problems. On the other hand, This is not suitable for the noise-containing empirical problems. For example, do you know “Hempel’s ravens?” In this universe, some excepts can occur by chance. We cannot state sentences determinedly. This is the reason why I redefine the word “analysis.”<br /><br />Are we unavailable to analysis the problem and reach the correct answer because we cannot get rid of the noise from the data? No. Actually, analysis isn’t able to lead us to the correct answer. However, analysis is able to says the probability of correctness of the hypothesis. Primary, we make an idea as a hypothesis. Our idea is still just a hypothesis. Secondary, we think the consequences when the hypothesis is true. If the hypothesis is true, this consequences coincide with the reality. If so, we can says “the hypothesis is <strong>probably</strong> true.” This part is what we call “validation.” The validation part is a essential component of analysis. To strictly validate the hypothesis makes you to get rid of your subjective judgement or sales staffs’ exaggerated reports. However, we still cannot say “the hypothesis is <strong>determindly</strong> true/false.”<br /><h2 id="two-measurements-of-error-in-data-science">Two Measurements of Error in Data Science</h2>Q.: Can we know how much probability our hypothesis<a class="footnote" href="https://en-ill-identified.blogspot.jp/2017/10/bad-practices-of-data-science.html#fn:hypothesis" id="fnref:hypothesis" title="See footnote">2</a> is true/false? A.: Data science makes you to calculate the degrees of error of your hypothesis. This is a great advantage of data science. Now, we can select the model which has less errors and we can say “this hypothesis is more close to the truth.”<br /><br />Although there are some differences between statistics and machine learning methodologies, there is at least one common point: It is that there are two kind of measurements of error.<br /><br />The first measurement is the <strong>goodness of fit</strong>. It denotes how much errors the hypothesis contains when it explains the data. It is also called “internal validity.”<br /><br />The second is the <strong>precision of prediction</strong>. It denotes how much errors the hypothesis contains when it explains the future data that we will get next week/month/year, or the data of potential customers. It is also called “external validity” or “generalization ability.”<br /><br />Both of two measurements make the analysis rigorous. Once you ignore at least one of these essential factors, your analysis report doesn’t become <b>RIGOROUS</b>, but <b>RIDICULOUS</b>, even if your data scientist/consultant uses decision tree/deep neural network/ensemble learning/other intricate methods. But in usually, to improve the precision of prediction is more difficult than to improve the other.<br /><center><a href="https://3.bp.blogspot.com/-QBjp6oD-aNE/Wet54TsVQfI/AAAAAAAAAJ8/OEBRpV9Pt7EuiBdFFIjNwY0i-nMSucETwCKgBGAs/s1600/extrapolating.png" imageanchor="1" ><img border="0" src="https://3.bp.blogspot.com/-QBjp6oD-aNE/Wet54TsVQfI/AAAAAAAAAJ8/OEBRpV9Pt7EuiBdFFIjNwY0i-nMSucETwCKgBGAs/s320/extrapolating.png" width="320" height="205" data-original-width="461" data-original-height="295" /></a><br />https://xkcd.com/605/ </center><h1 id="to-keep-yourself-not-being-deceived-by-ridiculous-analysis">To Keep Yourself not Being Deceived by Ridiculous Analysis</h1>You must carefully listen to the data scientists report. A fair data scientist does validate the hypothesis objectively, does not validate with his subjective judgement common sense. Though, this advise is too abstract for nonprofessionals to do practice. So I explain the following three famous examples.<br /><h2 id="example-1-cluster-analysis">Example #1: Cluster Analysis</h2>The cluster analysis provides intuitive graphics such that the tree diagram, and looks persuasive, but this is the very pitfall. The cluster analysis is <strong>not able to validate itself</strong>, and thus, strictly it is not analysis. <br /><br />In detail, although there are some indices of goodness of fit on the cluster analysis, these are valid only under some premises, and it is difficult to check them. Beginners often tend to validate it whether <strong>it fits his own sense</strong>, but such usage is not analysis. <br />For example, k-means method, one of the most popular cluster methods is assume that each sample point is distributed normally with the mean which is equal to the center of a cluster that it belongs to. This assumption implies that any cluster is circle, but who validated that? Can you assert that the shape of clusters are not oval, torus, vortex, or other complex figure?<br /><center><a href="https://2.bp.blogspot.com/-qU_8W3tTxs0/We4d0TGha7I/AAAAAAAAAKo/Yiq5gRFkbhwho27eZ7QHu_rfANEiKfSmgCLcBGAs/s1600/cluster.png" imageanchor="1" ><img border="0" src="https://2.bp.blogspot.com/-qU_8W3tTxs0/We4d0TGha7I/AAAAAAAAAKo/Yiq5gRFkbhwho27eZ7QHu_rfANEiKfSmgCLcBGAs/s320/cluster.png" width="320" height="215" data-original-width="600" data-original-height="404" /></a></center>Thus, if the report consists from only cluster analysis and author’s conclusions, you should better to doubt greatly. I interpret that the cluster analysis only plays a role in path finding of insight to data for further analyzing, or it can only make a hypothesis, and you need to monitor the forthcoming data and validate its hypothesis.<br /><h2 id="example-2-regression-analysis">Example #2: Regression Analysis</h2>The regression analysis is so popular as the cluster analysis, yet unlike the cluster analysis, we can validate the regression with both types of measurements: We can use the coefficient of determination (aka R2, or R-squared) for goodness of fit, and the information criterion (AIC or BIC, or so on) for precision of prediction.<br /><br />The regression analysis is also able to be abused: Excessive number of variables cause much excellent goodness of fit and very poor precision of prediction simultaneously. This phenomenon is called <strong>overfitting</strong> or <strong>overlearning</strong>. The following figure is one of the overfitting examples. if you predict the future (since 1997) stock index by a cubic polynomial, the prediction curve is drawn nearby the actual values, so its precision is not so bad. On the other hand, if you predict that by a polynomial of degree six, the curve fits the actual values better than the other by 1997, but it clearly derails since 1997. To avoid to abuse/misuse the regression analysis, we need to check that the presenter shows the precision of prediction in, for example, AIC or BIC, not only R2.<br /><center><br /></center><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-t79jyKRqycM/WeruVzKri-I/AAAAAAAAAJo/nSnR9am7x9ogXnAV3nDBRhN9E9yE2A74wCLcBGAs/s1600/overfit.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="404" data-original-width="600" height="215" src="https://2.bp.blogspot.com/-t79jyKRqycM/WeruVzKri-I/AAAAAAAAAJo/nSnR9am7x9ogXnAV3nDBRhN9E9yE2A74wCLcBGAs/s320/overfit.png" width="320" /></a></div><center></center><h2 id="example-3-hypothesis-testing">Example #3: Hypothesis Testing</h2>The hypothesis testing is also as popular as the above two methods. In particular, testing difference between means is very simple and useful to infer the effect of your sales promotion.<br /><br />However, this method has two major shortages; (1) it is not able to calculate the precision of prediction, and (2) its theoretical complexity makes beginners to misunderstanding that. The hypothesis testing is an in-sample method, so it judges the hypothesis by only current data and does not guarantee the future. I come up with four typical examples of misunderstanding.<br /><ol><li>To accept the hypothesis (He can misunderstand the significance level and the power).</li><li>To interpret the p-value as the size of the effect (p-value is not able to show the size of effect).</li><li>Tuning the sample size or the significance level until he gets a result which he want to show, to repeat testing (It’s cheating!).</li><li>Without any adjustment, To show multiple testing result simultaneously (He can misunderstand basic joint probability).</li></ol>However, because of its complexity, its explanation becomes too long to write here. I will write that someday if I get time.<br /><h1 id="summary-and-conclusions">Summary and Conclusions</h1>It is better to carefully hear how the presenter validate his model. If he only emphasize that we use the super best method of the machine learning, the deep learning or other up-to-date cool techniques ever seen, you should better to be more careful.<br /><br />There are other check points of sound data science practices, but I cannot enumerate all of them because of profoundness of data science.<br />Finally, I repeatedly state the essential points of this article. <br /><br />1. Analysis is the repeating of two-stage process to decrease the error of our notion. The first stage is to make a hypothesis, and the second is to validate the hypothesis. Any of both is essential.<br />2. In the context of the data science, there are two types of measurement of error. They are the goodness of fit and the precision of prediction. <br />3. It is difficult to validate the result of the cluster analysis. A good data scientist knows the technical limit of it. He can interpret the result properly and explain its defect. if he would explain just like that the hypothesis from clustering is already verified, you should better to be much careful.<br />4. It is very important to see both the goodness of fit and the precision of prediction in the context of the regression analysis. If the presenter show only the former (usually in R2), you should better to request him to show the latter. <br />5. The hypothesis testing is quite simple but is not able to predict. In addition, we can often misunderstand its usage because of the complexity of its theoretical foundation. There are some major typical mistakes about the hypothesis testing. Why don’t have to attend the meeting with the above checklist?<br /><blockquote>Written with <a href="https://stackedit.io/">StackEdit</a>.</blockquote><div class="footnotes"><hr /><ol><li id="fn:datascience">For simplicity, I use the word “data science” as the general term for statistical inference, machine learning, deep learning and so other methodologies of analyzing data. Then the “data scientist” is the professional who exploits data science methodologies. <a class="reversefootnote" href="https://en-ill-identified.blogspot.jp/2017/10/bad-practices-of-data-science.html#fnref:datascience" title="Return to article"><span class="emoji-outer emoji-sizer"><span class="emoji-inner" data-codepoints="21a9" style="background-position: 0% 25%; background-size: 4900%; background: url(chrome-extension://immhpnclomdloikkpcefncmfgjbkojmh/emoji-data/sheet_apple_64.png);"></span></span></a></li><li id="fn:hypothesis">In data science, the hypothesis is usually noted by mathematical equations. Such equations try to explain natural/social phenomena. We often call that the “model.” In this article, all of the word “hypothesis” can be translated into “model.” <a class="reversefootnote" href="https://en-ill-identified.blogspot.jp/2017/10/bad-practices-of-data-science.html#fnref:hypothesis" title="Return to article"><span class="emoji-outer emoji-sizer"><span class="emoji-inner" data-codepoints="21a9" style="background-position: 0% 25%; background-size: 4900%; background: url(chrome-extension://immhpnclomdloikkpcefncmfgjbkojmh/emoji-data/sheet_apple_64.png);"></span></span></a></li></ol></div>Satoshi KATAGIRIhttps://plus.google.com/103648077777322727860noreply@blogger.com2