<?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 Federico Mannucci on Medium]]></title>
        <description><![CDATA[Stories by Federico Mannucci on Medium]]></description>
        <link>https://medium.com/@federicomannucci_31459?source=rss-91303ad4525b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*b6Y--lqIEaadJe_oiJqmxA.png</url>
            <title>Stories by Federico Mannucci on Medium</title>
            <link>https://medium.com/@federicomannucci_31459?source=rss-91303ad4525b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 20 May 2026 13:39:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@federicomannucci_31459/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[Should you tell the interviewer that you’ve already seen the question]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://levelup.gitconnected.com/should-you-tell-the-interviewer-that-youve-already-seen-the-question-2520e315ad43?source=rss-91303ad4525b------2"><img src="https://cdn-images-1.medium.com/max/2600/0*pnWW4ZSy0asKPtrm" width="4000"></a></p><p class="medium-feed-snippet">What to do during a technical interview if you have already solved the problem before?</p><p class="medium-feed-link"><a href="https://levelup.gitconnected.com/should-you-tell-the-interviewer-that-youve-already-seen-the-question-2520e315ad43?source=rss-91303ad4525b------2">Continue reading on Level Up Coding »</a></p></div>]]></description>
            <link>https://levelup.gitconnected.com/should-you-tell-the-interviewer-that-youve-already-seen-the-question-2520e315ad43?source=rss-91303ad4525b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2520e315ad43</guid>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Federico Mannucci]]></dc:creator>
            <pubDate>Mon, 06 Mar 2023 03:49:26 GMT</pubDate>
            <atom:updated>2023-03-06T03:49:26.671Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Five Interview Mistakes I Am Not Doing Anymore]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/five-interview-mistakes-i-am-not-doing-anymore-85bbd0f234c5?source=rss-91303ad4525b------2"><img src="https://cdn-images-1.medium.com/max/2600/0*JKGMAx3zxV9F_KVp" width="6000"></a></p><p class="medium-feed-snippet">Lessons that you can apply in your next interview</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/five-interview-mistakes-i-am-not-doing-anymore-85bbd0f234c5?source=rss-91303ad4525b------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/five-interview-mistakes-i-am-not-doing-anymore-85bbd0f234c5?source=rss-91303ad4525b------2</link>
            <guid isPermaLink="false">https://medium.com/p/85bbd0f234c5</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[work]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[communication]]></category>
            <dc:creator><![CDATA[Federico Mannucci]]></dc:creator>
            <pubDate>Thu, 01 Dec 2022 11:11:52 GMT</pubDate>
            <atom:updated>2022-12-18T08:04:03.215Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[My Experience Interviewing with Google, Meta, Amazon]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/my-experience-interviewing-with-google-meta-amazon-2f0c8c9a2772?source=rss-91303ad4525b------2"><img src="https://cdn-images-1.medium.com/max/2600/0*1mncz0IF8hVKylSQ" width="5795"></a></p><p class="medium-feed-snippet">What I learned and how you can also land your offer</p><p class="medium-feed-link"><a href="https://medium.com/data-science/my-experience-interviewing-with-google-meta-amazon-2f0c8c9a2772?source=rss-91303ad4525b------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/my-experience-interviewing-with-google-meta-amazon-2f0c8c9a2772?source=rss-91303ad4525b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f0c8c9a2772</guid>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[amazon]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Federico Mannucci]]></dc:creator>
            <pubDate>Thu, 25 Aug 2022 08:39:48 GMT</pubDate>
            <atom:updated>2022-08-25T08:39:48.064Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Five things I have learned after solving 500+ Leetcode questions]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/five-things-i-have-learned-after-solving-500-leetcode-questions-b794c152f7a1?source=rss-91303ad4525b------2"><img src="https://cdn-images-1.medium.com/max/2600/0*hySI975thrTTxhUW" width="7730"></a></p><p class="medium-feed-snippet">Why grinding Leetcode is not so bad</p><p class="medium-feed-link"><a href="https://medium.com/data-science/five-things-i-have-learned-after-solving-500-leetcode-questions-b794c152f7a1?source=rss-91303ad4525b------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/five-things-i-have-learned-after-solving-500-leetcode-questions-b794c152f7a1?source=rss-91303ad4525b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b794c152f7a1</guid>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Federico Mannucci]]></dc:creator>
            <pubDate>Sun, 11 Apr 2021 18:57:51 GMT</pubDate>
            <atom:updated>2022-12-01T09:15:48.438Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How I became a Software Developer during the pandemic without a degree or a bootcamp]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/how-i-became-a-software-developer-during-the-pandemic-without-a-degree-or-a-bootcamp-ef7a4184efde?source=rss-91303ad4525b------2"><img src="https://cdn-images-1.medium.com/max/2600/1*1W5Y6ToGixrigCXMRv_zIA.jpeg" width="3943"></a></p><p class="medium-feed-snippet">I doubled my previous salary and landed my dream job in one year as a self-taught student, here is what I learned</p><p class="medium-feed-link"><a href="https://medium.com/data-science/how-i-became-a-software-developer-during-the-pandemic-without-a-degree-or-a-bootcamp-ef7a4184efde?source=rss-91303ad4525b------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/how-i-became-a-software-developer-during-the-pandemic-without-a-degree-or-a-bootcamp-ef7a4184efde?source=rss-91303ad4525b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef7a4184efde</guid>
            <category><![CDATA[mental-health]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Federico Mannucci]]></dc:creator>
            <pubDate>Mon, 19 Oct 2020 17:06:26 GMT</pubDate>
            <atom:updated>2022-08-22T20:36:55.606Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How long can you expect to live? Computers can answer]]></title>
            <link>https://medium.com/@federicomannucci_31459/how-long-can-you-expect-to-live-computers-can-answer-eaa9667451ff?source=rss-91303ad4525b------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaa9667451ff</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[jovian]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <dc:creator><![CDATA[Federico Mannucci]]></dc:creator>
            <pubDate>Thu, 04 Jun 2020 08:50:28 GMT</pubDate>
            <atom:updated>2020-07-03T07:08:52.989Z</atom:updated>
            <content:encoded><![CDATA[<h4>Predicting life expectancy using Machine Learning</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yipXgFfNSHgg47NQS8Tabw.jpeg" /><figcaption>Photo by T.Rolf on <a href="https://it.freeimages.com/photo/mother-inlaw-and-lau-1503633">freeimages.com</a></figcaption></figure><p>Yesterday I assisted to the <a href="https://www.youtube.com/watch?v=4ZZrP68yXCI">second lesson</a> of the course “Deep Learning with PyTorch: Zero to GANs” offered by <a href="https://www.jovian.ml/">Jovian.ml</a> in collaboration with <a href="https://www.freecodecamp.org/">FreeCodeCamp</a> (click on <a href="https://medium.com/@federicomannucci_31459/exploring-pytorch-in-5-functions-39eb96cc0180?source=friends_link&amp;sk=c28d657c0a0e13fad3cbdeafe5768d5a">this article</a> to read about the first lesson).</p><p>This time we focused our attention on using images to train a Logistic Regression model which can read handwritten digits, <a href="https://jovian.ml/aakashns/03-logistic-regression"><strong>this</strong></a> is what we were able to achieve by the end of the lecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U3Wp9ICAG4dgbG-y1fTlGw.png" /><figcaption>Examples of handwritten digits, similar to the ones used to train our model</figcaption></figure><p>The assignment I received required me to create and train a model on my own, using what I learned from the lesson, to accurately predict healthcare expenses from a few informations like age, BMI and smoking habits of each subject, <a href="https://jovian.ml/federico-abss/02-insurance-linear-regression"><strong>here</strong></a> you can view my final submission.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2F02-insurance-linear-regression%2Fv%2F42%26cellId%3D31%26hideInput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2F02-insurance-linear-regression%2Fv%2F42%26cellId%3D31%26hideInput%3Dtrue&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/d247d152673bf6ec3d0a44878a3b4e4b/href">https://medium.com/media/d247d152673bf6ec3d0a44878a3b4e4b/href</a></iframe><p>While working on the data outside the assignment scope I found out some interesting results, for example, have you ever considered how much smoking can affect your insurance cost?</p><p>Overall I consider the subject really stimulating, knowing an estimate of your future expenditure can have a very meaningful impact on how you decide to manage your finances, so I decided to go further and find what else I can discover using statistics and Machine Learning.</p><p>While exploring various datasets to decide what argument to tackle next I came across the <a href="https://www.kaggle.com/kumarajarshi/life-expectancy-who/data#">WHO Life Expectancy</a> data on Kaggle that caught my attention, I immediately set out to get other valuable insights and try constructing a machine learning model that can predict how many years a person can expect to live.</p><h4>Exploring The Data</h4><p>Let’s start approaching the dataset, it consists of 22 Columns and 2938 rows and contains information from 193 countries, spanning over the course of 15 years and detailing features like alcohol consumption, health care expenditure, BMI, and of course life expectancy.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F18%26cellId%3D7%26hideInput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F18%26cellId%3D7%26hideInput%3Dtrue&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ecb1ef9b37903c6ac38df8e4c0a0b45e/href">https://medium.com/media/ecb1ef9b37903c6ac38df8e4c0a0b45e/href</a></iframe><p>The data type for each column is appropriate, but unfortunately several values seem to be missing, 15% of rows under the GDP column are empty, and it’s even worse for the Population one, that arrives at 22%. <br>Using Pandas interpolate function I filled the empty rows where possible and dropped them otherwise.</p><p>Now that the data is clean let’s see how our target value is distributed inside the dataset, as well as its mean and range.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F21%26cellId%3D18%26hideInput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F21%26cellId%3D18%26hideInput%3Dtrue&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd22ed82fad05822755b66f290b18077/href">https://medium.com/media/dd22ed82fad05822755b66f290b18077/href</a></iframe><p>The mean is 69 years, the minimum value is as low as 36 and the maximum reaches 89, from these we can calculate the range to be of 53 years.</p><h4>How does each feature Affect Life Expectancy?</h4><p>To maintain the model simple and consistent I decided to build it using only the columns that have the strongest correlation with the value I want to predict.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Fhousing-linear-minimal%2Fv%2F12%26cellId%3D18%26hideInput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Fhousing-linear-minimal%2Fv%2F12%26cellId%3D18%26hideInput%3Dtrue&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/caa07abccf104464b869bac6173aa18a/href">https://medium.com/media/caa07abccf104464b869bac6173aa18a/href</a></iframe><p>To begin with, the country you live in strongly affects the number of years you can expect to live, not surprisingly first world country citizens live on average 79 years while for developing countries the number is 66 years.</p><p>After comparing how the other factors relate to life expectancy I found four of them, besides country status, that have a very strong correlation, these are each country GDP, adult mortality, years spent in school and income composition of resources (read about the <a href="https://en.wikipedia.org/wiki/Human_Development_Index">Human Development Index</a> for more details on the last factor).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F18%26cellId%3D28%26hideInput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F18%26cellId%3D28%26hideInput%3Dtrue&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a1409b3bdf1be6c918340b71daa361a/href">https://medium.com/media/8a1409b3bdf1be6c918340b71daa361a/href</a></iframe><p>And now here is what the dataframe, that includes these five variables which will be used to train and evaluate the model, looks like:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F18%26cellId%3D32%26hideInput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F18%26cellId%3D32%26hideInput%3Dtrue&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/9eee0d96694b4d939879bc6ba6577ac8/href">https://medium.com/media/9eee0d96694b4d939879bc6ba6577ac8/href</a></iframe><h4>Creating The Model</h4><p>I began by converting the collected data into tensors and splitting 15% of them into validation data that will be used only for testing purposes and defined a function that feeds the model a batch of 512 items randomly chosen from the training pool.</p><p>For a simple problem like this linear regression is more than adequate, I created a class called LifeModel that contains all the basic components of the model and initialized it, right now this is its loss value:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D44&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D44&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2a0d47735dbd8f855b9e7168a4d34ae/href">https://medium.com/media/a2a0d47735dbd8f855b9e7168a4d34ae/href</a></iframe><p>Having used the l1 Smooth Loss function to calculate this value means that any prediction made using the model will be off by 1933.5 years on average, we are definitely not close to the result we want to achieve!</p><h4>Training</h4><p>The function called fit is responsible for training and logging the progress of the loss value a definite number of times.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D46&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D46&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/3efaa62e46834f1219bd582e5bc57255/href">https://medium.com/media/3efaa62e46834f1219bd582e5bc57255/href</a></iframe><p>After one thousand iterations with the chosen learning rate the model is drastically better but the overall linear improvement rate seems to suggest that the learning rate is a bit small and can be increased to approach the minimum faster.<br>Ahead is represented the improvement for this first training cycle.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D49%26hideInput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D49%26hideInput%3Dtrue&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/dceefeba02cb491967ae94a12e1b30c1/href">https://medium.com/media/dceefeba02cb491967ae94a12e1b30c1/href</a></iframe><p>After other two thousand iterations with different learning rates it finally reached a good accuracy level, the model now is off only by six years on average when making a prediction.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D51&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D51&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c26af3726003853508351c219ddf6811/href">https://medium.com/media/c26af3726003853508351c219ddf6811/href</a></iframe><h4>Making a Prediction</h4><p>Now that the model has completed the training phase it can be used for making a prediction using the values saved in the validation dataset, I provided already a couple of examples.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D54&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D54&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/22c3328a3201a64a1ca34b813925581a/href">https://medium.com/media/22c3328a3201a64a1ca34b813925581a/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D56&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F20%26cellId%3D56&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b1d941a57f18107a38f399940cfe31d1/href">https://medium.com/media/b1d941a57f18107a38f399940cfe31d1/href</a></iframe><h4>Improving The Model</h4><p>Update: I was challenged to improve the model and try different architectures and features to see how they would affect the results.</p><p>Firstly I tried to introduce more layers to the model but that didn’t seem to improve the accuracy, maybe the model is simple enough that using non-linear functions ends up being superfluous.</p><p>After I decided that if expanding the model ‘depth’ didn’t work out then maybe increasing his ‘width’, by adding one or more column to the input layer, coming back to the dataset I realized that HIV is a great candidate to be used in the model.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F28%26cellId%3D29%26hideInput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F28%26cellId%3D29%26hideInput%3Dtrue&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/da11780397a03d0e9d0c895d815d8c90/href">https://medium.com/media/da11780397a03d0e9d0c895d815d8c90/href</a></iframe><p>This attempt actually ended up providing the best result with an accuracy of 91.5%, confirming that HIV affects life expectancy substantially.</p><p>Another try consisted of using every feature in the dataset as input, but that actually led to a slightly worse outcome due to some columns not having a relevant correlation with the target we want to predict.</p><p>The last attempt involving using other techniques like <strong>Learning rate scheduling</strong>, that allowed me to achieve a comparable result with less than half the time the other models needed.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F28%26cellId%3D51%26hideInput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2Flife-expectancy-linear%2Fv%2F28%26cellId%3D51%26hideInput%3Dtrue&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Ffederico-abss%2Fprofile_images%2Ff433c469d76245b9a90de1f8b80d3c61%2Fmedium.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff785c5423f3ec256c54df926be16e08/href">https://medium.com/media/ff785c5423f3ec256c54df926be16e08/href</a></iframe><p>Overall the model didn’t improve drastically but I learned a lot about different architectures and ways to do machine learning, so it can definitely be called a successful experiment.</p><p>I collected the parameters used as well as the results obtained during the various iterations of the project, here are them visualized using Jovian’s ‘compare versions’ feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6iMyZj280b2q7JrTkSGQxA.jpeg" /><figcaption>Jovian allows you to keep track and compare any details out of several versions of your work</figcaption></figure><h4>Conclusions</h4><p>I was genuinely proud when this blogpost was featured in the <a href="https://youtu.be/9suSsTVhYuw?t=971">course third lesson</a>, I really appreciate Aakash for taking the time to read it and evaluate and for the shoutout as well, it means a lot to me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*11FVsp_A-dhLPGPshAz7KQ.png" /></figure><p>At this point nothing stops us from using the model with more recent data, the dataset stops in 2015, or if you are daring enough even using your personal details to have a peek of what your own life expectancy is estimated to be.</p><p>Thanks again to Jovian for their wonderful course and to you for reaching the end of the article, <a href="https://jovian.ml/federico-abss/life-expectancy-linear"><strong>this</strong></a><strong> </strong>is the notebook it is based on, feel free to use it to experiment with this model or build your own!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaa9667451ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring PyTorch in 5 functions]]></title>
            <link>https://medium.com/@federicomannucci_31459/exploring-pytorch-in-5-functions-39eb96cc0180?source=rss-91303ad4525b------2</link>
            <guid isPermaLink="false">https://medium.com/p/39eb96cc0180</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[jovian]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Federico Mannucci]]></dc:creator>
            <pubDate>Sun, 24 May 2020 17:17:35 GMT</pubDate>
            <atom:updated>2020-05-24T17:17:35.692Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ptAr8z5oSDXYT9FyWHLl_A.png" /><figcaption>PyTorch is a deep learning framework developed by Facebook</figcaption></figure><p>Yesterday I took part in the first lesson from the course “Deep Learning with PyTorch: Zero to GANs” kindly offered by <a href="https://www.jovian.ml/">Jovian.ml</a> in collaboration with <a href="https://www.freecodecamp.org/">FreeCodeCamp</a>, to help the community to become proficient with machine learning tools and techniques and empower ourselves with this newly acquired knowledge.</p><p>The course is composed of six lectures that will be transmitted live on FreeCodeCamp’s YouTube channel during the course of six weeks, together with various individual assignments and projects. <br>Even if you missed the first lesson you can catchup by watching <a href="https://www.youtube.com/watch?v=vo_fUOk-IKk">the vod</a> and submit the first assignment to join the other students and be eligible for a certificate of completion if you finish the course!</p><p>The lesson held yesterday was about how to use Jupyter Notebooks and the Jovian platform itself, that will be used to showcase our work, the fundamentals of PyTorch like tensors, and an introduction to some ML techniques like Linear Regression and how to apply it to real world problem using PyTorch.</p><h3>My assignment from the lesson</h3><p>The first assignment given to us was getting comfortable with analyzing the Pytorch library on our own by exploring five random functions of our choice and writing a notebook explaining them in short detail.</p><p>I will provide a little recap ahead but you are welcome to check <a href="https://jovian.ml/federico-abss/01-tensor-operations">my Jupyter Notebook</a> hosted on Jovian for more examples and insights, as well as <a href="https://pytorch.org/docs/stable/tensors.html">the official documentation</a>.</p><h4>Function 1 — torch.ones</h4><p>Returns a tensor of the specified size filled only with ones:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D3&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D3&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/c6f7cad5a3f763ccc43630f3dd7e0a70/href">https://medium.com/media/c6f7cad5a3f763ccc43630f3dd7e0a70/href</a></iframe><p>The type is going to be float by default but we can change it with an optional argument.</p><h4>Function 2 — torch.abs</h4><p>Computes the absolute value of every element contained inside the given input tensor:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D10&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D10&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/7dd6a05afa5a59e27d624775ed3a0904/href">https://medium.com/media/7dd6a05afa5a59e27d624775ed3a0904/href</a></iframe><p>This is the output when the function is tested with a simple array of integers.</p><h4>Function 3 — torch.allclose</h4><p>Compares the size of two tensors and their content, and confirm if those values are the same, within a certain margin of tolerance, by returning a Boolean value:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D18&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D18&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0f92ff55c6c49b62553c6580a0392d0/href">https://medium.com/media/d0f92ff55c6c49b62553c6580a0392d0/href</a></iframe><p>Two tensors of the same size and containing the same values will give a True output.</p><h4>Function 4 — torch.numel</h4><p>Returns the total number of elements in the input tensor:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D26&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D26&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fc6faef2db776435378a8d77dcc99cd/href">https://medium.com/media/8fc6faef2db776435378a8d77dcc99cd/href</a></iframe><p>Of course an array of length three will contain three elements.</p><h4>Function 5 — torch.max</h4><p>Returns the maximum value/s of all elements in the input tensor in the form of a new tensor:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ml%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D34&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ml%2Ffederico-abss%2F01-tensor-operations%2Fv%2F4%26cellId%3D34&amp;image=https%3A%2F%2Fjovianml.s3.amazonaws.com%2Fpreview-large.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/c12146779ad07cd6e4f2076f9857ba67/href">https://medium.com/media/c12146779ad07cd6e4f2076f9857ba67/href</a></iframe><p>A simple example with integers in an array returns a scalar.</p><h4>Thanks a lot for reading my first blogpost!</h4><p>If you are interested in reading more submissions from the Jovian community please visit <a href="https://jovian.ml/forum/t/share-your-work-here/1567">the forum</a>!</p><p>I also want to add an heartfelt thank you to Jovian and Aakash N S for providing this brilliant learning opportunity!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39eb96cc0180" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>