<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lan</title>
    <description>The latest articles on DEV Community by Lan (@allands).</description>
    <link>https://dev.to/allands</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F450442%2F7742d9cd-3acb-4d48-a635-33d4b995dead.jpg</url>
      <title>DEV Community: Lan</title>
      <link>https://dev.to/allands</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/allands"/>
    <language>en</language>
    <item>
      <title>4 Lessons I learned using data science in a real scientific article</title>
      <dc:creator>Lan</dc:creator>
      <pubDate>Tue, 20 Jul 2021 00:22:33 +0000</pubDate>
      <link>https://dev.to/allands/4-lessons-i-learned-using-data-science-tools-on-real-science-articles-2a5o</link>
      <guid>https://dev.to/allands/4-lessons-i-learned-using-data-science-tools-on-real-science-articles-2a5o</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NeUbLfuf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aosf5ebncigsa8oftiu3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NeUbLfuf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aosf5ebncigsa8oftiu3.jpg" alt="" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Over the past few years, there's been an outrageous growth on the interest towards data science, that's a fact. However, there were two main publics for the "new" knowledge field:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Computer scientists who produce data science related articles(Deep Learning models, Transformation techniques comparisons).&lt;/li&gt;
&lt;li&gt;People who wanted new skills to work at a high-paying industry.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Personally, I don't think I fit in neither of those. I always felt it was good that the potential data science had as a tool was finally being popularized, but there was a point that bothered me: at the time this article was written, data science still wasn't being broadly used as a research tool at other knowledge fields other than computer science.&lt;/p&gt;

&lt;p&gt;So, being a Physics major student at UFRJ(one of the best brazilian universities), and a self taught data scientist, I tried to find a research group at the university, with the aim to use the Data Science skills I had to produce better evidence to a scientific work.&lt;/p&gt;

&lt;p&gt;Soon, I joined a group already writing a article. The group used statistics to determine which &lt;a href="https://en.wikipedia.org/wiki/Comorbidity"&gt;comorbidities&lt;/a&gt; statistically led more people to die of Covid-19. Along with that, I also asked the question: how well can you predict someone's death based on symptons they have. The article was published internationally, and the results and discussion can be seen &lt;a href="https://www.researchsquare.com/article/rs-435549/v1"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Finally, here are 4 lessons I learned through 8 months working on the article.&lt;/p&gt;

&lt;h2&gt;
  
  
  1 - Science isn't a straight line
&lt;/h2&gt;

&lt;p&gt;What I mean by that is: science is not your beginner project, with a well defined dataset, and no responsability attached. First of all: the data you have is usually a mess, and the longest part of the workflow is cleaning it. Second: the decision making process on what to do with each variable is basically a way of molding reality before feeding your model. Is is a tiring process, but it makes all the difference to the outcome if well done.&lt;/p&gt;

&lt;p&gt;When working on an article, there is always a hypothesis. Those who initially thought on the hypothesis surely have a guess on what the result will turn out to be. &lt;/p&gt;

&lt;p&gt;However, that should always be a main point of attention, since grasping too hard on what you expect the result to be might mislead you into &lt;em&gt;confirmation bias&lt;/em&gt; (google it up if you haven't heard of it. It's important). That leads us to the second point:&lt;/p&gt;

&lt;h2&gt;
  
  
  2- Science learns from bad results
&lt;/h2&gt;

&lt;p&gt;If a model or analysis didn't result on pretty visualizations and excellent models, there's always something to learn from that.&lt;/p&gt;

&lt;p&gt;Maybe, the data just doesn't answer the question you're asking. Maybe, there's some information about how the data was collected or what each variable means exactly that you don't know, that would make all the difference to the outcome. &lt;strong&gt;Data is not a human: it won't lie to you.&lt;/strong&gt; So, try to listen to what it is trying to tell you, rather than only seeing what you expect.&lt;/p&gt;

&lt;h2&gt;
  
  
  3- Model performance isn't always the main goal
&lt;/h2&gt;

&lt;p&gt;Working on the article, our main goal was to measure the relative importance between our variables to the model's outcome. Whilst working on it for a few weeks, we faced a problem: the model performed better when we removed 2 especific variables. If it was a industry problem, it wouldn't be a problem: results are the main goal, so just delete it.&lt;/p&gt;

&lt;p&gt;However, in our case, it was not wise to remove these variables. Although they were irrelevant to the model's performance, they were relevant healthcare indicators. Does it mean we designed bad features? Does this indicate a systematic problem on the way data was collected? &lt;/p&gt;

&lt;p&gt;In my example, our data was collected in hospitals by stressed out healthcare workers from a developing country during a pandemic. We can't simply close our eyes to the logistic and humanitarian challenge. Or maybe, it just means that the variable we thought was an important indicator for Covid-19 deaths turned out not to be. Don't forget the first point.&lt;/p&gt;

&lt;h2&gt;
  
  
  4- Reproducibility matters
&lt;/h2&gt;

&lt;p&gt;When working with data science, we(at least I did!) tend to develop models and analysis in a messy way. No one else is going to read it, so why bother making it easy to read and accessible?&lt;/p&gt;

&lt;p&gt;First of all, reproducibility is not about making things look good: it is all about making sure that every decision you took is clear, including: where you took the data from, what feature engineering decisions you made along the path, how you dealt with missing values, how you chose a model, and how and why the metrics you're using were chosen.&lt;/p&gt;

&lt;p&gt;The scenario you have to imagine is: suppose someone has the same data you have, can they reproduce your exact results only with information you put on the article? If not, it shouldn't be considered science. You're no better than magicians.&lt;/p&gt;

&lt;p&gt;Don't get me wrong, it's not that I don't trust you: science isn't about trust. Would you trust a rocket only a scientist said work? Or would you rather have it checked by dozens of experienced engineers?&lt;/p&gt;

&lt;p&gt;It's only science if it can be reproduced.&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>python</category>
      <category>beginners</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>How machine learning made me win more on League of Legends</title>
      <dc:creator>Lan</dc:creator>
      <pubDate>Fri, 02 Oct 2020 19:14:17 +0000</pubDate>
      <link>https://dev.to/allands/how-machine-learning-made-me-win-more-on-league-of-legends-3on5</link>
      <guid>https://dev.to/allands/how-machine-learning-made-me-win-more-on-league-of-legends-3on5</guid>
      <description>&lt;p&gt;I surely don't know you, but I'm sure either of these statements is true: you have either played League of Legends before, or you know at least someone who did. That's fact.&lt;/p&gt;

&lt;p&gt;The multiplayer online battle arena(MOBA) game has become a fever over the last decade, having reached in 2021 a simultaneous player count record of 11 million players. Since I'm a nerd myself, until last year I used to also be a regular player, just like that one person you know or are.&lt;/p&gt;

&lt;p&gt;This year, searching through Kaggle to find cool data that I could work on a data science project, I stumbled upon a &lt;a href="https://www.kaggle.com/bobbyscience/league-of-legends-diamond-ranked-games-10-min" rel="noopener noreferrer"&gt;dataset&lt;/a&gt; that contains information about the first 10 minutes, the early game, of several diamond-tier matches. After looking through the data for a while, I asked myself the question: how well can I predict which team is going to win? &lt;/p&gt;

&lt;p&gt;Also, it is of general knowledge in the data science field that, if your model is a good predictor of something, that means it can also tell you &lt;strong&gt;which features of your data were more helpful to the prediction&lt;/strong&gt;(that's called explainability in AI). So, going back to our data: if our model is a good predictor of which team is going to win, it is also a good method to know which game features you should focus more on improving to win more matches and climb up the rank.&lt;/p&gt;

&lt;p&gt;For this analysis, I tried a few ML &lt;a href="https://en.wikipedia.org/wiki/Decision_tree_learning" rel="noopener noreferrer"&gt;tree&lt;/a&gt; models, and ended up with &lt;a href="https://xgboost.readthedocs.io/en/latest/" rel="noopener noreferrer"&gt;xgboost&lt;/a&gt;, which performed the best with a &lt;strong&gt;75% accuracy&lt;/strong&gt; on test data.&lt;/p&gt;

&lt;p&gt;If you wish to go into more technical detail than that, check out the &lt;a href="https://www.kaggle.com/allanbruno/predicting-wins-based-on-early-game-75-accuracy" rel="noopener noreferrer"&gt;notebook&lt;/a&gt;. From now on I will only be showing results.&lt;/p&gt;




&lt;h3&gt;
  
  
  So, what can we learn from early game?
&lt;/h3&gt;

&lt;p&gt;A plot of feature importance for our model:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Important&lt;/em&gt;: &lt;code&gt;Diff&lt;/code&gt; On the variable names stands for (BlueTeam - RedTeam) of that quantity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2ur98jjizbt31us6buat.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2ur98jjizbt31us6buat.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1 - Gold is what matters.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As seen on the feature importance graph, gold difference is by far the most important variable for our model. The fact that Exp difference is the second most important, probably means that farming is one of the most efficient ways to earn gold(also, it gives you more experience at a lower risk). That probably means you should be paying more attention to farming and lane phase than getting kills.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;2 - Don't forget elite monsters.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the 3rd and 5th position, we have elite monsters, so don't underestimate them. These buffs really can change the outcome of a match.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;3 - Blocking vision is just as valuable as setting vision.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A surprising fact is that destroying wards is just as important as placing it. Leaving the enemy team blind is just as important as giving your team vision.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;4 - Assists matter.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That doesn't mean that an assist by itself is that relevant to gold difference, but the meaning behind it: play with your team. Teams that are united usually get more kills, map pressure and objectives.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;5 - Sacrificing yourself for an elite monster is not always worth it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Elite monsters are important and can give you huge map pressure, but if that means having your entire team killed for it, maybe it's not that worth it. Play smart.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;6 - Early game matters more than you think.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A model with data only from the 10 minutes of a match can predict it's outcome with a 75% accuracy, what does it tell you? The pace and attitude that you set at the beginning, most times, can be the difference between a victory or defeat.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final considerations
&lt;/h2&gt;

&lt;p&gt;Considering all the lack of information, I think our model performed great, as it correctly guessed the outcome of ~75% matches only looking at a reduced amount of early game data.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>beginners</category>
      <category>leagueoflegends</category>
    </item>
  </channel>
</rss>
