<?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 Nezar Assawiel on Medium]]></title>
        <description><![CDATA[Stories by Nezar Assawiel on Medium]]></description>
        <link>https://medium.com/@nezar.a?source=rss-3799981825a2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4ZH4tfTlk0RxiInBIoLi7g.jpeg</url>
            <title>Stories by Nezar Assawiel on Medium</title>
            <link>https://medium.com/@nezar.a?source=rss-3799981825a2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:31:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nezar.a/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[How to build production-scale, cloud ML model in few minutes!]]></title>
            <link>https://medium.com/data-science/how-to-build-production-scale-cloud-ml-model-in-few-minutes-7d1bc59deac9?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d1bc59deac9</guid>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[big-data-analytics]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Fri, 31 May 2019 13:42:20 GMT</pubDate>
            <atom:updated>2019-05-31T13:42:20.645Z</atom:updated>
            <content:encoded><![CDATA[<h4>Build, train and deploy a machine learning model in literally few minutes using only SQL on Google Cloud.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0PCgHG2hB4wboDEA" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As part of its effort to gain a larger market share in the cloud computing market, Google Cloud has been adding powerful tools to its platform, especially around AI. One of these tools is BigQuery ML, which enables a user to develop and train ML models on large datasets within few minutes!</p><p>If you are not familiar with it already, BigQuery is a serverless data warehouse that enables SQL queries where you only pay for query-data-usage and storage (It is “similar” to Redshift on AWS).</p><p>Since mid 2018, BigQuery has enabled users to build ML models with few lines of SQL code within few minutes. This post will walk you through the steps needed to build such ML models.</p><p><strong>Note</strong>:</p><ul><li>The example used in illustrating the steps is inspired by <a href="https://cloud.google.com/bigquery-ml/docs/bigqueryml-natality">one</a> of BigQuery’s official tutorials.</li><li>If you wish to execute the code presented, you can find it <a href="https://github.com/nezar-a/tutorials/blob/master/bigquery_ml_demo.ipynb">here</a>.</li></ul><h4><strong>1) Ingest your data into BigQuery:</strong></h4><p>There are several ways for loading data into BigQuery if it is not already. In fact, you don’t need to load data into BigQuery to query it as you can query external data. However, if you are concerned about speed, it is a good idea to upload your data to BigQuery.</p><p>Here, we will use the <strong>natality dataset</strong>, which has details about the United States births registered between 1969 and 2008, to <strong>predict the weight of a new born baby</strong>. It is already available in BigQuery as a public dataset <a href="https://bigquery.cloud.google.com/table/publicdata:samples.natality?tab=details"><strong>here</strong></a>.</p><h4>2) Explore and preprocess the data:</h4><p>Let us consider the last 10 years in the dataset, where the values are meaningful (i.e. &gt; 0) by running the following query:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*fgRLgYFeUrcG0RJx-GzN-Q.png" /></figure><p>which yields the following table:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsheetsu.com%2Ftables%2F708c0f0b01&amp;dntp=1&amp;url=https%3A%2F%2Fsheetsu.com%2Ftables%2F708c0f0b01&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=sheetsu" width="700" height="361" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5176035dc9b48a5083507421e7085e5/href">https://medium.com/media/f5176035dc9b48a5083507421e7085e5/href</a></iframe><p>As you can see from the table above, there are several columns that seem to be suitable for creating features to predict the weight of a new born, namely:</p><pre><strong>is_male</strong>,<br><strong>plurality</strong>,(one baby, twins, ...etc)<br><strong>mother_age</strong>,<br><strong>gestation_weeks</strong>,(duration of pregnancy in weeks)<br><strong>weight_gain_pounds </strong>(weight gained by the mother during the pregnancy in pounds)</pre><p>To examine whether these columns can be leveraged into features or not, one can plot these columns against the weight_pounds column (target of the prediction) in a Jupyter or a Datalab notebook, for example, and explore. Checking for missing data, sparsity …etc. is essential for good feature engineering. For simplicity, let us skip this step and go with our intuition!</p><h4>3) Define and engineer features:</h4><p>With the columns that will be leveraged into features selected in the previous step, let us see how we can code our features in BigQuery.</p><p>Note that in BigQuery ML all strings are considered categorical features and all numeric values are considered continuous features. As such, our 5 features will be defined as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*IHdf9ggn73ZJlbxa_-NdsA.png" /></figure><p>Running the above query yields:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsheetsu.com%2Ftables%2Faaf7cefc05&amp;dntp=1&amp;url=https%3A%2F%2Fsheetsu.com%2Ftables%2Faaf7cefc05&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=sheetsu" width="700" height="361" frameborder="0" scrolling="no"><a href="https://medium.com/media/e45f7a244b2d1b8845ca966cd2da8b18/href">https://medium.com/media/e45f7a244b2d1b8845ca966cd2da8b18/href</a></iframe><p>Note the hashmonth column. We made a hash value for every month in the last 10 years of the dataset (year&gt;1998) to make a training/evaluation datasets split in the next step without leakage (i.e. babies with the same birthdate should be either in the training or evaluation set).</p><h4>3) Create and train ML model:</h4><p>Before creating the ML model, a BigQuery dataset is needed to store the model, which is easily created by clicking “create a dataset” from BiQuery web UI. Let us name this dataset BigQDemo.</p><p>The SQL command CREATE MODEL creates and trains the model. Since we are predicting the weight of a new born which is a continuous value, a linear regression model was chosen for the model_type in the following query. Running the this query (which takes about 4 minutes) creates and trains a ML model named NewBornWeight_Model!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*cTfc5WmADUnv54nGLkDgYA.png" /></figure><p>The trained model appears under the BigQDemo dataset as a table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*pLc5FV7gexP_Lp68lBnOhg.png" /></figure><p>Training statistics, such as the loss and learning rate, can be viewed by exploring the NewBornWeight_Model table or by running the following query:</p><pre>SELECT * FROM ML.TRAINING_INFO(MODEL BigQDemo.NewBornWeight_Model);</pre><p>You can find all the other model types and optional parameters for BigQuery ML in the official documentations <a href="https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create">here</a>.</p><h4>4) Evaluate the trained model:</h4><p>The command ML.EVALUATE is used to evaluate the trained model. In our case, let us evaluate the model on the remaining 20% of the data that was not used during training (see the condition AND MOD (..., 5)&gt;= 4 in the query below):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*0Izgx2LqRSBbpAPw9a1w1w.png" /></figure><p>which yields the following results:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsheetsu.com%2Ftables%2F9e23d7f918&amp;dntp=1&amp;url=https%3A%2F%2Fsheetsu.com%2Ftables%2F9e23d7f918&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=sheetsu" width="700" height="158" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb6aefbe42de6e011bb4d50f30a47bf3/href">https://medium.com/media/fb6aefbe42de6e011bb4d50f30a47bf3/href</a></iframe><h4>5) Predict with your model</h4><p>When you are satisfied with your model, you can use it to predict using the command ML.PREDICT. Let us predict the baby weight for 50 examples from the last 10 years of the natality dataset:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*LL_FCj-AShqWRWl1EYJLmg.png" /></figure><p>As you can see in the table below, when the ml.PREDICT command is used, the prediction column is automatically named predicted_&lt;label_column_name&gt;.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fsheetsu.com%2Ftables%2F8b0b65c164&amp;dntp=1&amp;url=https%3A%2F%2Fsheetsu.com%2Ftables%2F8b0b65c164&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=sheetsu" width="700" height="361" frameborder="0" scrolling="no"><a href="https://medium.com/media/e66985ca7adf275b92bae0fe689f1e7f/href">https://medium.com/media/e66985ca7adf275b92bae0fe689f1e7f/href</a></iframe><p>With that, you have a fully functioning ML model!</p><p>BigQuery ML is not only useful in building ML models as part of a Google Cloud data pipeline or enabling non-technical staff to run ML models; but also in quickly testing the effects of newly designed complex ML features, for example, on large datasets. Thus, BigQuery ML is particularly useful for ML developers when executed directly from the development environment, such as Jupyter notebooks, for example.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d1bc59deac9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/how-to-build-production-scale-cloud-ml-model-in-few-minutes-7d1bc59deac9">How to build production-scale, cloud ML model in few minutes!</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rejected? Get inspired by the stories of science/tech giants]]></title>
            <link>https://medium.com/free-code-camp/rejected-get-inspired-by-the-stories-of-science-tech-giants-76c1b007d63a?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/76c1b007d63a</guid>
            <category><![CDATA[inspiration]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[job-hunting]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Mon, 17 Dec 2018 22:12:27 GMT</pubDate>
            <atom:updated>2018-12-18T23:25:22.014Z</atom:updated>
            <content:encoded><![CDATA[<h3>Rejected? Get inspired by the stories of science and tech giants</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*075MvqkChXLP0wbBcN4osQ.jpeg" /></figure><p>Getting that rejection call or email is not pleasant. You feel disappointed, sad, confused, or teary-eyed. It is especially hard after getting so many no’s, or when you know that you are objectively an excellent candidate for the job. You start doubting yourself and wondering what you are missing.</p><p>While there is always room for improvement from your end, there is always room for mistakes from the other end. Those mistakes could be the worst ones of their careers and the biggest opportunities of yours. Treat each rejection as what it is — possibly the best thing that ever happened to you.</p><p>When doubt starts getting to your head because you received many rejections, remember that some of the greatest scientists and entrepreneurs were rejected many times, too. Those rejections have led to much better outcomes. Here are some of the rejection stories that inspire me to keep going in the face of rejections.</p><h3>Albert Einstein</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*zb1BsZFVv48c_0xBG2c_xw.jpeg" /></figure><p>After graduating with a degree in mathematics and physics in 1900, Albert Einstein could not find anybody to hire him. He got rejected from all the schools and colleges to which he applied for a teaching or a research post.</p><p>He was struggling so much to find a job that he thought about switching fields and selling insurance! His father wrote letters to his friends, without telling Einstein, asking if they could get a job for his son, with no success.</p><p>After almost two years of unemployment, the desperate Einstein moved to Bern — the Swiss capital — where the father of one of his friends got him a job as a junior patent examiner. He worked there until 1909.</p><p>Einstein used to finish his tasks quickly and use the rest of his time to work on scientific research that interested him. During that time — specifically 1905 — he published four of the most important scientific papers ever published. These papers laid the foundation of modern physics in space, time, mass and, energy.</p><h3>Srinivasa Ramanujan</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*lEF9EAo8mBKpJ9Fk4-g0Pw.jpeg" /></figure><p>Despite living in poverty for most of his life, receiving little formal education, and passing away at the age of 32, Srinivasa Ramanujan contributed substantially to the field of mathematics.</p><p>Ramanujan was able to get a scholarship to attend college. However, his strong interest in mathematics distracted him, thus he failed other subjects and was dropped from the scholarship. He enrolled in another college later and failed other subjects again.</p><p>With no college degree, he pursued his mathematical research independently. He lived in poverty and was going door-to-door looking for a clerical job. He would show prospective employers his work and send letters to mathematicians and colleges, detailing advanced theorems that he came up with.</p><p>Some didn’t respond to him, some thought he was a fraud, and some were impressed by the work he presented but doubted it was his. There were others, however, who gave him letters of introduction to other notable mathematicians.</p><p>His break came as a reply and a sponsorship from G. Hardy — a mathematician at Cambridge University — who recognized the work of a genius. Ramanujan traveled to the UK to work with Hardy, and become one of the youngest Fellows of the Royal Society in history, at the age of 31.</p><h3>Jack Ma</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*ktn9BgupbtbXnyYpPlckLw.jpeg" /></figure><p>Jack Ma, the founder of Alibaba and a global business leader, had his fair share of rejections. After graduating college from his home city of Hangzhou, China, he applied for 30 jobs and got rejected from all of them. He applied to be a police officer. Out of five applicants, he was the only one rejected.</p><p>He was even rejected by KFC. When they came to his home city, he tried to get a job with them. Out of 24 applicants, he was the only one rejected, he stated.</p><p>Later on, the rejections did not stop! Ma tried to get into Harvard Business School ten times, and got rejected every time. When he came to the USA in 2001 to raise $5 million investment, he got rejected. “…we [will] come back raising a little bit more,” he said.</p><p>Ma attributes his resilience and success as entrepreneur in part to the rejections he encountered all the way.</p><h3>Brian Acton</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*Tl1k5krjLgRFZqWrSwjpoA.jpeg" /></figure><p>Brian Acton, co-founder of WhatsApp, got his “best thing happened to me” rejections as well. In 2009, Acton —a software engineer with years of experience at Yahoo and Apple —got rejected by Twitter, then Facebook.</p><p>As no other company he aspired to join would hire him, he took the entrepreneurship route and started WhatsApp with Jan Koum — another Yahoo alum.</p><p>Five years later, the cloud-based messaging company co-founded by Acton changed how people text around the world. The company who rejected him earlier — Facebook — wanted him. This time, they had to pay $19 billion to acquire his company and hire him back.</p><h3>Brian Chesky</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*o934XHCFzJ5z3z3gsg-dBw.jpeg" /></figure><p>In 2008, Brian Chesky, co-founder and CEO of Airbnb, was a “nobody” entrepreneur looking for someone to believe in him, his small team, and their idea.</p><p>Chesky and his team were looking for $150,000 investment for 10% of Airbnb. One of his friends introduced him to seven potential investors. Five of them rejected him, and the other two didn’t bother to even reply to him.</p><p>Ten years later, in 2018, Airbnb is the largest hotel company in the world. Rejecting Chesky’s 10% offer turned to be a $3 billion mistake for those investors now that Airbnb is valued at $30 billion.</p><h3>Kevin Systrom</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*WjCYbp8RUKEIHzZi4roX_Q.png" /></figure><p>Systrom, the co-founder of Instagram, joined Google right after graduating Stanford.</p><p>He worked with Salar Kamangar — a senior Google executive— who was impressed by Systrom, and wanted to transfer him to Googles’s Associate Product Manager (APM) program.</p><p>The APM program is an elite rotational program at Google where a select few are chosen and given vital roles in real-impact projects.</p><p>Systrom was rejected because the program only accepted candidates with a computer science degree. This occurred despite Salar Kamangar’s efforts to convince his fellow executives to accept Systrom who “is a brilliant self-taught programmer with a history of working closely with engineers to ship products”.</p><p>Frustrated by the rejection, Kevin left Google to later co-found Instagram in 2010 and sell it to Facebook for $1 billion two years later.</p><h3>The lesson</h3><p>While rejection is a setback in the short term, it is a necessary step to potential significant outcomes in the long term that are unlikely to happen without it.</p><p>We have a choice. We can choose to get depressed over the rejections we receive because “we are not good”. Or we can choose to have faith that our future days want the superiority for us by getting in the way of inferiority. I choose the latter and I trust you do too!</p><h3>Sources</h3><p>[1] Einstein: <a href="https://en.wikipedia.org/wiki/Albert_Einstein">Wikipedia</a>, <a href="https://www.youtube.com/watch?v=Uvpw6Jh1WGQ">The Extraordinary Genius of Albert Einstein</a>.</p><p>[2]Srinivasa Ramanujan: <a href="https://en.wikipedia.org/wiki/Srinivasa_Ramanujan">Wikipedia</a>, <a href="https://blog.stephenwolfram.com/2016/04/who-was-ramanujan/">Who Was Ramanujan?</a></p><p>[3] Jack Ma: <a href="https://en.wikipedia.org/wiki/Jack_Ma">Wikipedia</a>,<a href="https://www.youtube.com/watch?v=2baJreTbMvs"> Rejection — Jack Ma</a>.</p><p>[4] Brian Acton: <a href="https://en.wikipedia.org/wiki/Brian_Acton">Wikipedia</a>, <a href="https://www.forbes.com/sites/georgeanders/2014/02/19/he-wanted-a-job-facebook-said-no-in-a-3-billion-mistake/#bdd2cf852441">Forbes</a>.</p><p>[5] Brain Chesky: <a href="https://en.wikipedia.org/wiki/Brian_Chesky">Wikipedia</a> , <a href="https://medium.com/@bchesky/7-rejections-7d894cbaa084">Brian Chesky’s Medium</a></p><p>[6] Kevin Systrom: <a href="https://en.wikipedia.org/wiki/Kevin_Systrom">Wikipedia</a>, <a href="https://books.google.ca/books?id=fEJ0AwAAQBAJ&amp;printsec=frontcover&amp;source=gbs_ge_summary_r&amp;cad=0#v=onepage&amp;q&amp;f=false">How Google Works</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76c1b007d63a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/rejected-get-inspired-by-the-stories-of-science-tech-giants-76c1b007d63a">Rejected? Get inspired by the stories of science/tech giants</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What to do when your training and testing data come from different distributions]]></title>
            <link>https://medium.com/free-code-camp/what-to-do-when-your-training-and-testing-data-come-from-different-distributions-d89674c6ecd8?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d89674c6ecd8</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 01:09:45 GMT</pubDate>
            <atom:updated>2018-11-29T01:09:45.420Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*IH5uBePl83tyOcWgzU7eyg.jpeg" /><figcaption>credit: <a href="https://www.chessbazaar.com/blog/game-chess-can-make-child-genius-smarter/">https://www.chessbazaar.com/blog/game-chess-can-make-child-genius-smarter/</a></figcaption></figure><p>To build a well-performing machine learning (ML) model, it is essential to train the model on and test it against data that come from the same target distribution.</p><p>However, sometimes only a limited amount of data from the target distribution can be collected. It may not be sufficient to build the needed train/dev/test sets.</p><p>Yet similar data from other data distributions might be readily available. What to do in such a case? Let us discuss some ideas!</p><h4><strong>Some background knowledge</strong></h4><p>To better follow the discussion here, you can read up on the following basic ML concepts, if you are not familiar with them already:</p><ul><li><strong>Train, dev (development), and test sets: </strong>Note that the dev set is also called the validation or the hold-on set. <a href="https://towardsdatascience.com/train-validation-and-test-sets-72cb40cba9e7">This post</a> is a good short introduction to the topic.</li><li><strong>Bias (underfitting) and variance (overfitting) errors: </strong><a href="https://www.quora.com/What-is-the-best-way-to-explain-the-bias-variance-trade-off-in-layman%E2%80%99s-terms">This</a> is a great simple explanation of these errors.</li><li><strong>How the train/dev/test split is correctly made:</strong> You may refer to <a href="https://medium.freecodecamp.org/how-to-strategically-accomplish-your-machine-learning-models-performance-goals-44dddc11697e">this post</a> that I have<strong> </strong>written before for a short background on this topic.</li></ul><h3>Scenario</h3><p>Say you are building a dog-image classifier application that determines if an image is of a dog or not.</p><p>The application is intended for users in rural areas who can take pictures of animals by their mobile devices for the application to classify the animals for them.</p><p>Studying the target data distribution — you found that the images are mostly blurry, low resolution, and similar to the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*nW58sKM3ZvMJlAFXLODewA.jpeg" /><figcaption><em>Left: Dog (Volpino Italiano breed), Right: Arctic fox.</em></figcaption></figure><p>You were only able to collect 8,000 such images, which is not enough to build the train/dev/test sets. Let us assume you have determined you’ll need at least 100,000 images.</p><p>You wondered if you could use images from another dataset — in addition to the 8,000 images you collected — to build the train/dev/test sets.</p><p>You realized you can easily scrape the web to build a dataset of 100,000 images or more, with similar dog-image vs. non-dog-image frequencies to those frequencies required.</p><p>But, clearly this web dataset comes from a different distribution, with high resolution and clear images such as the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*xga0JnLEFAp2noV5cOm4sg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*TKO7lTdjyAbmaZTF5rSJmA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*kdTFThnUHH5m5Cp19OSpMw.png" /><figcaption>Images of dogs (left and right) and a fox (center).</figcaption></figure><p>How would you build the train/dev/test sets?</p><p>You can’t only use the original 8,000 images you collected to build the train/dev/test sets as they are not enough to make a well-performing classifier. Generally, computer vision as other natural perception problems — speech recognition or natural language processing — need a lot of data.</p><p>Also, you can’t only use the web dataset. The classifier will not perform well on the users’ blurry images, which are different from the clear, high definition web images used to train the model.</p><p>So, what do you do? Let us consider some possibilities.</p><h4>A possible option — shuffling the data</h4><p>Something you can do is to combine the two datasets and randomly shuffle them. Then, split the resulting dataset into train/dev/test sets.</p><p>Assuming you decided to go with a 96:2:2% split for the train/dev/test sets, this process will be something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*rnQh1csEwjlWuD0PQ7mZEw.png" /></figure><p>With this set up, the train/dev/test sets all come from the same distribution, as illustrated by the colors in the graph above, which is desired.</p><p>However, there a big drawback here!</p><p>If you look at the dev set, out of 2,000 images, on average only 148 images come from the target distribution.</p><p>This means that for the most part you are optimizing the classifier for the web images distribution (1,852 images out of 2,000 images) — which is <strong>not </strong>what you want!</p><p>The same thing can be said about the test set when assessing the performance of the classifier against it. So, this is not a good way to make the train/dev/test split.</p><h4>A better option</h4><p>An alternative is to make the dev/test sets come from the target distribution dataset, and the training set from the web dataset.</p><p>Say you’re still using 96:2:2% split for the train/dev/test sets as before. The dev/test sets will be 2,000 images each — coming from the target distribution — and the rest will go to the train set, as illustrated below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*dYD6-bMOxBHy5F4oDKAC2A.png" /></figure><p>Using this split, you will be optimizing the classifier to perform well on the target distribution, which is what you care about. This is because the images of the dev set come solely from the target distribution.</p><p>However, the training distribution is now different from the dev/test distribution. This means that for the most part, you are training the classifier on web images. Thus, it will take longer and more effort to optimize the model.</p><p>More importantly, you will not be able to easily tell if the classifier error on the dev set relative to the error on the train set is a variance error, a data mismatch error, or a combination of both.</p><p>Let us consider this in more detail, and see what we can do about it.</p><h4>Variance vs data mismatch</h4><p>Consider the train/dev/test split from the second option above. Assume the human error is zero, for simplicity.</p><p>Also, let us assume you found that the training error to be 2% and the dev error 10%. How much of the 8% error between these two is due to the data mismatch between the two sets — given they are coming from different distributions? And how much is due to the variance of the model (overfitting)? We can’t tell.</p><p>Let us modify the train/dev/test split. Take out a small portion of the train set and call it the “bridge” set. The bridge set will not be used to train the classifier. It is instead an independent set. The split now has four sets belonging to two data distributions — as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*Xb4wPdb1EDdpMSI-fnBOgg.png" /></figure><h4>Variance error</h4><p>With this split, let us assume you found training and dev errors to be 2% and 10%, respectively. You found the bridge error to be 9%, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*HPahUKzbP_A5MJhPJ16fTQ.png" /></figure><p>Now, how much of the 8% error between the train and dev set errors is a variance error, and how much of it is a data mismatch error?</p><p>Easy! The answer is 7% variance error and 1% data mismatch error. But why?</p><p>It’s because the bridge set comes from the same distribution as the train set, and the error difference between them is 7%. This means the classifier is overfitted to the train set. This tells us we have a <strong>high variance problem</strong> at hand.</p><h4>Data mismatch error</h4><p>Now, let us assume you found the error on the bridge set to be 3% and the rest as before as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*Jd6ATayPmJlUwnIzvx7_Lw.png" /></figure><p>How much of the 8% error between the train and dev sets is a variance error and how much of it is a data mismatch error?</p><p>The answer is 1% variance error and 7% data mismatch error. Why so?</p><p>This time, it is because the classifier performs well on a dataset it hasn’t seen before if it comes from the same distribution, such as the bridge set. It performs poorly if it comes from a different distribution, like the dev set. Thus, we have a <strong>data mismatch problem</strong>.</p><p>Reducing the variance error is a common task in ML. For example, you can use regularization methods, or allocate a larger train set.</p><p>However, mitigating the data mismatch error is a more interesting problem. So, let us talk bout it.</p><h4>Mitigating data mismatch</h4><p>To reduce the data mismatch error, you would need to somehow incorporate the characteristics of the dev/test datasets — the target distribution — into the train set.</p><p>Collecting more data from the target distribution to add to the train set is always the best option. But, if that is not possible (as we assumed at the beginning of our discussion), you can try the following approaches:</p><h4>Error analysis</h4><p>Analyzing the errors on the dev set and how they are different from the errors on the train set could give you ideas to address the data mismatch problem.</p><p>For example, if you find many of the errors on the dev set occur when the background of the animal’s image is rocky, you can mitigate such errors by adding animal images with rocky background to the train set.</p><h4>Artificial data synthesis</h4><p>Another way to incorporate the characteristics of the dev/test sets into the train set is to synthesize data with similar characteristics.</p><p>For example, we mentioned before that the images in our dev/test sets are mostly blurry in contrast to the clear images from the web that make most of our train set. You can artificially add blurriness to the images of the train set to be more similar to the dev/test sets as in the following image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*ccdA1VDjODoImAgJgk0VaQ.jpeg" /><figcaption>Image from the train set before and after blurring.</figcaption></figure><p>However, there is an important point to notice here!</p><p>You could end up overfitting your classifier to the artificial characteristics you made.</p><p>In our example, the blurriness you artificially made by some mathematical function might only be a small sub-set of the blurriness that exists in the images of the target distribution.</p><p>In other words, the blurriness in the target distribution could be due to many reasons. For example, fog, low resolution camera, subject movement could all be causes. But your synthesized blurriness may not represent all of these causes.</p><p>More generally, when synthesizing data for the training set for any type of problem (such as computer vision, or speech recognition), you could overfit your model to the synthesized dataset.</p><p>This dataset may look representative enough of the target distribution to the human eye. But in fact, it is only a small set of the target distribution. So, just keep this in mind while using this powerful tool — data synthesis.</p><h4>In Summary</h4><p>When developing an ML model, ideally the trian/dev/test datasets should all come from the same data distribution — that of the data which the model will encounter when used by the userbase.</p><p>However, sometimes it is not possible to collect enough data from the target distribution to build the trian/dev/test sets, while similar data from other distributions is readily available.</p><p>In such cases, the dev/test sets should come from the target distribution while the data from the other distributions can be used to build (most of) the train set. Data mismatch techniques can then be used to mitigate the the data distribution differences between the train set vs the dev/test sets.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d89674c6ecd8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/what-to-do-when-your-training-and-testing-data-come-from-different-distributions-d89674c6ecd8">What to do when your training and testing data come from different distributions</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to strategically accomplish your machine learning model’s performance goals]]></title>
            <link>https://medium.com/free-code-camp/how-to-strategically-accomplish-your-machine-learning-models-performance-goals-44dddc11697e?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/44dddc11697e</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Mon, 19 Nov 2018 16:32:48 GMT</pubDate>
            <atom:updated>2018-11-19T16:32:48.630Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*VyUN0eeSx1yujR3tP3zToQ.jpeg" /><figcaption>“three dart pins” by <a href="https://unsplash.com/@darts_pictures?utm_source=medium&amp;utm_medium=referral">Alexander Muzenhardt</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>Machine learning (ML) development is an iterative process. You have an idea to solve the problem at hand, you build the idea and examine the results. You get another idea to improve the results and so on until you reach the performance goal that deems your model ready for deployment into production — ready to use by end users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*U8P5m8XWda4KS0o-YXj22g.png" /><figcaption>Figure 1. The iterative process in ML development.</figcaption></figure><p>However, there are often many ideas and possibilities you can try to improve the performance and get closer to your goal. For example, you can collect more data, train longer, or try bigger or smaller networks.</p><p>Going in the wrong direction during this experimentation process can be costly, especially for large projects. No one wants to spend two months collecting more data to discover later on that the performance gain was negligible and it was not worth a day let alone two months!</p><p>Strategically setting and working towards the performance goal of your ML model is vital in speeding up the experimentation process and achieving that goal. In this post, I present some tips that will hopefully help you in this regard.</p><h3>Expected prior knowledge</h3><p>This post assumes knowing, at least, the basics of building a ML model. This discussion is not meant to illustrate what a ML model is or how to build one. Rather, the content is on how to strategically improve a ML model during the development process. <strong>Specifically, the following concepts and terminologies should be familiar to you:</strong></p><ul><li><strong>train, dev (development), and test sets: </strong>The dev set is also called the validation or the hold-on set. <a href="https://towardsdatascience.com/train-validation-and-test-sets-72cb40cba9e7">This post</a> is a great short introduction to the topic.</li><li><strong>evaluation (or performance) metrics: </strong>Which are the measures used to indicate how “good” a ML model is in doing its job. <a href="https://towardsdatascience.com/metrics-to-evaluate-your-machine-learning-algorithm-f10ba6e38234">Here is a post</a> covering some of the basic metrics used in ML.</li><li><strong>bias (underfitting) and variance (overfitting) errors: </strong><a href="https://www.quora.com/What-is-the-best-way-to-explain-the-bias-variance-trade-off-in-layman%E2%80%99s-terms">This</a> is great explanation of these errors in a simple way.</li></ul><h3>The importance of orthogonalization</h3><p>As you know, the sequential steps in developing a ML model are as follows:</p><ol><li>fit the training set well. For example try a bigger network, try another cost-function optimization method, try training longer.</li><li>fit the dev set well. For example try regularization, try collecting more training data.</li><li>fit the test set well. For example try a bigger dev set.</li><li>perform well in production. If not, the dev set needs to change or the cost function of the model.</li></ol><p>During this process, ideally you would like the modifications you try — “model controls” — to be independent. Why?</p><p>Consider, for example, the steering wheel of a car. When you steer the wheel left, the car moves left. When you steer it right, the car moves right. What if steering the wheel left moved the car left <strong>and</strong> increased the speed of the car? It would become much more difficult to control the car, right? Why? Because steering the wheel left is <strong>not an independent control</strong> of the car any more. It is coupled with another control, the speed control<em>. </em>It is always easier when the controls are independent.</p><p>In ML development, <strong>early stopping</strong>,<em> </em>for example,<em> </em>is a form of regularization used to improve the performance on the dev set by training only on a part of the training set. So, early stopping is a control that is <strong>not independent from</strong> another control, namely how long you train.</p><p>For faster iterative development process, you would like the independence of your controls, that is, <strong>orthogonalization</strong>. In other words, consider avoiding dependent controls like<em> </em>early stopping<em> </em>as much as you can for faster development process.</p><h3>Strategies</h3><p>With the previous introduction in mind, here are some tips to set and strategically improve your model’s performance:</p><h4><strong>a) Combine multiple evaluation metrics into one</strong></h4><p>It is likely you have several evaluation metrics to evaluate the performance of your ML model. For example, you might have recall and precision to evaluate a classifier. Recall and precision are competing metrics — typically when one increases, the other decreases. So, how do you choose the best classifier from Table 1 below, for example?</p><p>It is a good idea in this case to combine precision and recall into one metric. The F1 score [F1 score= (2 *precision*recall)/(precision + recall)] will do, as you might have realized already. As such, Classifier A from Table 1 will have the best F1 score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*ctEddCfuf30E1F2fUU8Xag.png" /><figcaption>Table 1. Performance results of a classifier (synthetic data).</figcaption></figure><p>Obviously, this process is problem-specific. Your application might require maximizing precision. In this case, Classifier C in Table 1 will be your best choice.</p><p><strong>Optimizing and satisficing</strong></p><p>You might want to follow the optimizing and satisficing approach. Meaning, you are optimizing one metric as long as the other metric(s) meet a certain minimum threshold.</p><p>Assume the classifiers from Table 1, and accuracy and run-time as two metrics as shown in Table 2 below. You may be mainly concerned about optimizing one metric — accuracy — as long as the other metrics — run-time — meet a certain threshold. In this example, the run-time threshold is 50 ms or less. So, you are looking for the classifier with the highest accuracy <strong>as long as</strong> the run-time is 50 ms or less. Thus, from Table 2, you would choose Classifier B.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*oIdwy7GunYgC-wucUyT4FQ.png" /><figcaption>Table 2. Performance results of a classifier (synthetic data).</figcaption></figure><p>However, if your aim is to maximize the performance across all metrics, you would need to combine them.</p><p>It is not always easy to combine all metrics into one. There may be many of them. The relationship between them is not clear. In such cases, you would need to be <strong>creative</strong> and <strong>careful</strong> in combining them! The time you invest in coming up with an <strong>all-in-one</strong> performance metric is worth it. It won’t only speed up the development process, but will also produce a well-performing model in production.</p><h4><strong>b) Set the train, dev, and test sets correctly</strong></h4><p><strong>Choose the right size for the train/dev /test split</strong></p><p>You have likely seen the 60%, 20%, 20% split for the train, dev, test data sets, respectively. This works well for small data sets — say 10k data points or fewer. However, when working with large data sets, especially with deep learning, a 98%, 1%, 1% split or similar might be more appropriate. If you have 2 million data points in your dataset, a 1% split is 20K data points which are enough for the dev and test sets.</p><p>In general, you want your dev set to be large enough to capture the changes you make to your model during your experimentation process. You want your test set to be large enough to give you high confidence in the performance of your model.</p><p><strong>Make sure the dev and test sets come from the same distribution</strong></p><p>While this may seem trivial, I have seen experienced developers forget this important point. Say you have experimented and iteratively improved a model that predicts default on car loans based on zip code. Don’t expect your model to work correctly on a test set from zip code areas with low average-income if the dev set comes from zip code areas with high average-income, for example. These are two different distributions!</p><p><strong>Make sure the dev and test sets reflect the data your model will encounter in production</strong></p><p>For example, if you are doing face-recognition, the resolution of your dev/test images should reflect the resolution of the images in production. While this might be a trivial example, you should examine all aspects of the data on which your application would work in production in comparison to your train/dev/test data. If your model is doing well on your metric and dev/test sets but not so well in production, you have the wrong metric and/or the wrong dev/test sets!</p><h4><strong>c) Identify and tackle the “correct” error first</strong></h4><p><strong>Bayes’ error and human error</strong></p><p>Bayes’ error is the theoretical lowest error that exists in a model, in other words irreducible error. Consider, for example, a dog classifier that predicts if the image at hand is of a dog or another animal. There might be some images that are so blurry that are impossible to classify by humans or even the most sophisticated system that has ever been invented. This will be Bayes’ error.</p><p>Human error, by definition, is larger — worse — than Bayes’ error. However, human error is usually very close to Bayes’ error since we are really good at recognizing patterns. Thus, human error is usually used as a proxy for Bayes error.</p><p><strong>Improving below human-level performance</strong></p><p>When the performance of your ML model is below human-level performance, you can improve the performance by:</p><ol><li>getting more labeled data by humans</li><li>analyzing the errors and incorporating the insights into the system. Why does the ML model get this and that wrong while humans get them right?</li><li>improving the model itself. Look at whether it underfits — high bias error — or overfits — high variance error — and change the model accordingly.</li></ol><p>Once human-level performance is surpassed, improving the performance becomes a much slower and more difficult process as you would expect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*w1t_VT7pdZ9uUNXsp2Ue7w.png" /><figcaption>Figure 2. Performance curve of a typical ML model as a function of time productively spent in improving the performance (illustrative figure).</figcaption></figure><p>So, how do you define human error exactly? This is what is discussed next!</p><p><strong>Defining human error and identifying the error to tackle first</strong></p><p>Consider the dog classification problem from before — recognizing if an image is of a dog or not. After doing some research, you might find the human error as follows:</p><ul><li>average person: 2% error</li><li>average zoologist: 1% error</li><li>expert zoologist: 0.6% error</li><li>a team of expert zoologists: 0.4% error</li></ul><p>Now, consider the four cases in Table 3 below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*8gRbRq5Ob6xRfzJMRtK0rw.png" /><figcaption>Table 3. Errors of a dog-image classifier (synthetic data). Human Error (top to bottom) are of: team of expert zoologists, an expert zoologist, the average zoologist, and the average person.</figcaption></figure><p>In Case A, your priority should be the underfitting problem — high bias — as indicated by the errors in red, since the bias error (5% -2% =3%) is larger than the variance error (6% -5% =1%). For the human error, the <em>largest</em> among the human errors that are <em>smaller than the training error</em> is used <em>first</em>. Thus, your human error reference in this case is that of the average person — 2% — since it is the largest error among the human errors that are smaller than the training error (all of them in this case).</p><p>In Case B, you might need to improve the variance error first, 9%-5%=4%, since it is larger than the bias error of 5%-2%=3%.</p><p>In Case C, you surpassed the human performance of the average person and you are tied to the performance of the average zoologist. So, your new human error should be that of the expert zoologist — 0.6% — or even the team of expert zoologists — 0.4%. The variance error in this case is 0.2% while the bias error is between 0.4% and 0.6%. So, you should work on this error first — need to better fit the training data.</p><p><strong>Surpassing human performance</strong></p><p>In Case D, you see that the training error is 0.2% while the best human error is 0.4%. Does this mean your model surpassed human performance or the model overfits by 0.2%?! You see, it is not clear whether to focus on the bias error or the variance error. Also, if, indeed, your model surpassed human performance and you are still looking to improve the model, it becomes unclear which strategy to follow from a human intuition perspective.</p><p>There are many ML models nowadays that surpass human performance, such as product recommendation and online-ad targeting systems. These “models that surpass human performance” tend to be non-natural perception systems, that is, not computer vision, speech recognition or natural language processing systems. The reason for this is that we humans are really good at natural perception tasks.</p><p>With big data and deep learning, however, there are natural perception systems that surpass human performance and they are getting better and better. But these are much harder problems than non-natural perception problems.</p><p>Originally published at<a href="http://www.assawiel.com/blog"> assawiel.com/blog </a>on March 24, 2018. Edited: Oct 4, 2018</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44dddc11697e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-strategically-accomplish-your-machine-learning-models-performance-goals-44dddc11697e">How to strategically accomplish your machine learning model’s performance goals</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create and connect to Google Cloud Virtual Machine with SSH]]></title>
            <link>https://medium.com/free-code-camp/how-to-create-and-connect-to-google-cloud-virtual-machine-with-ssh-81a68b8f74dd?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/81a68b8f74dd</guid>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[virtual-machine]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Fri, 02 Nov 2018 16:45:23 GMT</pubDate>
            <atom:updated>2018-11-02T16:45:23.972Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/707/0*uGmqUMo3h7NHNCkP.jpg" /><figcaption>Image source: <a href="https://www.redeszone.net/2017/08/01/descargar-maquinas-virtuales-vmware-virtualbox-windows/">https://www.redeszone.net/2017/08/01/descargar-maquinas-virtuales-vmware-virtualbox-windows/</a></figcaption></figure><p>Google Cloud offers many tools and services. One of these services is creating highly customizable virtual machines. If you are not familiar with what a virtual machine is, here is a definition from Microsoft:</p><blockquote>A virtual machine is a computer file, typically called an image, that behaves like an actual computer. In other words, creating a computer within a computer. It runs in a window, much like any other program, giving the end user the same experience on a virtual machine as they would have on the host operating system itself. The virtual machine is sandboxed from the rest of the system, meaning that the software inside a virtual machine can’t escape or tamper with the computer itself.</blockquote><p>Virtual machines are needed in many situations to test applications against other operating systems, to access virus-infected data, or to experiment with other operating systems. You can install virtual machines on your computer. You can also create them in the cloud and simply connect to them.</p><p>In this tutorial, I will walk you through how to create a virtual machine in Google Cloud. We can connect to it with SSH from your computer.</p><ol><li>If you don’t have one already, create a Google Cloud account from <a href="https://cloud.google.com/">here</a>.</li></ol><p>You will get $300 credit to play around with for a year! It is more than enough to learn and play with everything Google Cloud offers.</p><p>2.<strong> </strong>Create a new project or use an existing one. You can create a new project called <strong>project1</strong>, for example, as in the following gif:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WrKj6-2VjHl_9q-czpNx5g.gif" /></figure><p>3. Now you are set to create a virtual machine. Go to the top left corner of your Google Cloud home page, click on the triple bar icon ≡ and select <strong>Compute Engine -&gt;VM instance<em> </em></strong>and click <strong>Create</strong>.</p><p>Enter whatever name you want in the <strong>Name</strong> field as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*bzRAFZ6Q9kmJBHs8OhxCsQ.png" /></figure><p>Keep the default region and zone. Any region/zone will do for this tutorial. If you are curious about what they mean, you can read Google Cloud’s documentation about them <a href="https://cloud.google.com/compute/docs/regions-zones/">here</a>.</p><p>You can keep default machine type or click <strong>Customize </strong>to<strong> </strong>select the number of CPU cores, memory, and GPUs you would like your virtual machine to have. You will see the cost on the right side changes!</p><p>For your first experiments with Google Cloud, you can be conservative with the $300 credit for some actual work. In such a case, you can choose the following configuration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*gbF6jcDvPgAOcU1V.png" /></figure><p>Next choose a boot disk. For example, you can choose <strong>20 GB, SSD, Ubuntu 16.04 LTS</strong> as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/0*jUSn1A-9ALKvftap.png" /></figure><p>Then set the <strong>Service Account</strong> under <strong>Identity and API access</strong> to <strong>No service account </strong>as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*0489aSLgy_3FR-O61Vj8Kw.png" /></figure><p>Finally, go to the <strong>Security</strong> tab under <strong>Firewall</strong>. You will see an <strong>SSH Key</strong> field as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*zw4sgudS11XJik7MxzJ6hw.png" /></figure><p>This where you are going to connect your computer to the virtual machine using your SSH Key!</p><p>If you are not familiar with SSH (Secure Shell) and why you may want to use it, it is a network protocol that provides encrypted data communication between two computers (your computer and Google’s servers, in this case) which are connected over an insecure network (the Internet here).</p><p>To establish an SSH connection, you <em>may</em> need an application that can do that, depending on your operating system.<strong> Follow the rest of this post depending on your operating system (Windows or Mac/Linux).</strong></p><h4><strong>Windows</strong></h4><p>I recommend <strong>PuTTY</strong>. It is an open-source and easy to use SSH client. You can download PuTTY and install it from <a href="https://www.putty.org/">here</a>.</p><p>After installing PuTTY, open <strong>PuTTY Key Generator</strong> and click <strong>create</strong>. It will generate a random key by <strong>you</strong> moving the mouse over the blank area. After it is done, you will get something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/0*u-7VpDq3B0Vg2_aT.png" /></figure><p>Change the <strong>key comment </strong>field to something recognizable and easy to type, as this will become a user name later!</p><p>Then save both the public and private keys by clicking the corresponding icons shown in the picture above.</p><p>Highlight the whole <strong>Key</strong> field from the PuTTY Key Generator, and copy and paste it in the <strong>key data</strong> field in Google Cloud:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/0*a1b5Fr3Rn1HsM99p.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/0*aE9OGI5l9scGjrcc.png" /></figure><p>Click<strong> create</strong> and wait for the virtual machine instance to be created.</p><p>In the meantime, you can go to PuTTY. Go to <strong>SSH -&gt;Auth</strong> and browse for the private key file that you saved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/0*LUmIhVhyIMo6rf0t.png" /></figure><p>Next, go to Google Cloud and copy the external IP from the virtual machine instance that you just created as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/0*HFMz-Po4G97uCoeA.png" /></figure><p>And paste it on the Host field under <strong>Sessions</strong> in PuTTY and hit <strong>Enter</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/0*n2gqq_d4kebudw4v.png" /></figure><p>Note: you might get an error message. Ignore it and click <strong>yes</strong>. (It just says the key is not already in the registry. Are you sure you want to connect?)</p><p>Then enter the username you created when generating the key (<strong>key comment</strong> above). Boom! you are in the virtual machine that you just created.</p><p>You can install python and Google APIs on it, for example, to start making some magic! Don’t forget to shut it down in Google Cloud after you are done to be economic with your credit :)</p><h4><strong>Mac/Linux</strong></h4><p>Mac and Linux support SSH connection natively. You just need to generate an SSH key pair (public key/private key) to connect securely to the virtual machine.</p><p>The private key is equivalent to a password. Thus, it is kept private, residing on your computer, and should not be shared with any entity. The public key is shared with the computer or server to which you want to establish the connection. To generate the SSH key pair to connect securely to the virtual machine, follow these steps:</p><p>Enter the following command in Terminal: ssh-keygen -t rsa . It will start the key generation process. You will be prompted to choose the location to store the SSH key pair. Press ENTER to accept the default location as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*hp5pk9SnHXh30gy3Vv_5TA.png" /></figure><p>Next, choose a password for your login to the virtual machine or hit ENTER if you wish not to use a password. The private key (i.e. identification) and the public key will be generated as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*gD5KQEg_zkyflml45ZX2pA.png" /></figure><p>Now run the following command: cat ~/.ssh/id_rsa.pub . It will display the public key in the terminal as shown below. Highlight and copy this key:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*qlDANOptw8XYi2Idhj2GiQ.png" /></figure><p>and paste it in the SSH key field in Google Cloud and hit <strong>Create</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*fJ-2Sz0DVKMqBooIJMHkIw.png" /></figure><p>Now you can use the <strong>External IP</strong> of the virtual machine you just created:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*3-fETHGuwa2yleCwGcNOng.png" /></figure><p>to <em>ssh</em> to it as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*JUyO30D2oDdtS0SRwyPb2Q.png" /></figure><p>You will get “The authenticity of host…etc.” warning as shown in the picture below. This is normal. Whenever SSH connects to a system it hasn’t seen before, it will generate a warning like this. Reply <strong>yes </strong>to connect, and bingo!<strong> </strong>You are in the virtual machine, as you can see from host name <strong>instance-3. </strong>To exit the virtual machine, just type<strong> exit.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*zloUpB2sVTbag6eGjC_MEA.png" /></figure><p>Don’t forget to shut the virtual machine in Google Cloud after you are done to save that $300 credit!</p><p><em>Originally published at</em><a href="http://www.assawiel.com/blog"><em> assawiel.com/blog </em></a><em>on December 23, 2017. Updated: Oct 10, 2018</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81a68b8f74dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-create-and-connect-to-google-cloud-virtual-machine-with-ssh-81a68b8f74dd">How to create and connect to Google Cloud Virtual Machine with SSH</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 6 Python libraries for Data Manipulation and Visualization]]></title>
            <link>https://medium.com/@nezar.a/top-6-python-libraries-for-data-manipulation-and-visualization-379ba3a3b754?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/379ba3a3b754</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Mon, 03 Jul 2017 00:00:00 GMT</pubDate>
            <atom:updated>2018-10-09T19:10:40.569Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0rtb3pXID3v31UdL" /><figcaption>“person holding sticky note” by <a href="https://unsplash.com/@hiteshchoudhary?utm_source=medium&amp;utm_medium=referral">Hitesh Choudhary</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Here is a short overview of the top 6 python libraries that a data science/machine learning learner needs to know. I divided them into two categories: 1) Essential libraries for data manipulation 2) Essential visualization libraries. I presented the libraries in each category based on the order that I think most suitable for new learners.</p><h4>1) Essential libraries for data manipulation:</h4><ul><li>NumPy: NumPy (short for Numerical Python), is the first library a new data science Lerner would need. It is part of the SciPy stack (not SciPy the library! which is also part of the SciPy stack). This library provides array and matrices manipulation and operations and speed up the execution of otherwise slow programs that don’t use vectorization.</li><li>Pandas: This library is part of the SciPy stack as well and designed for “tabulated” or “relational” data. It is really a powerful tool for manipulating and charting such data. This library has two main data structures: 1-dimensional data structure called series and two-dimensional data structure called data frame.</li><li>SciPy: this is the 3rd library that I think a new learner should learn as part of this category. It is part of the SciPy stack as well and contains linear algebra, statistic and other models. Mainly, this library makes use of NumPy.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/0*mJxKeCSPKsiESJjQ.png" /><figcaption>Google trend for the above 3 libraries between May 2016 and May 2017</figcaption></figure><h4>2) Visualization libraries:</h4><ul><li>Matplotlib: this is a powerful library inspired by the visualization capabilities of MatLab. It can generate very simple chart and graphs to very complex interactive graphs. With high flexibility comes..wait for it..low level programming! This library is a bit low level and thus you would need more code than the more higher-level libraries. However, I would recommend learning it first even a little bit before learning the higher-level visualization libraries. It is worth it!</li><li>Seaborn: this library is based on Matplotlib and geared towards displaying statistical models and distributions like bar charts, heat maps and so on.</li><li>Bokeh: this library is independent of Matplotlib; but has strong community around it as well. It is focus is on interactive visualization that use Data-Driven Documents (d3.js).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/0*sHDVDF3oExBmv_Y1.png" /><figcaption>Google trend for the above 3 libraries between May 2016 and May 2017</figcaption></figure><p><em>Originally published at</em><a href="http://www.assawiel.com/blog"><em> assawiel.com/blog </em></a><em>on July 3, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=379ba3a3b754" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Should I Learn TensorFlow or Keras?]]></title>
            <link>https://medium.com/@nezar.a/should-i-learn-tensorflow-or-keras-4bfe35d508a8?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bfe35d508a8</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[libraries]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[keras]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Tue, 02 May 2017 00:00:00 GMT</pubDate>
            <atom:updated>2018-10-09T19:37:27.428Z</atom:updated>
            <content:encoded><![CDATA[<h3>Should I Learn TensorFlow or Keras First?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*wrMxqYmSk6o4H6SeABTjMg.jpeg" /></figure><p>One of the things that frustrates programming learners in any programming field is which library to learn (or to learn first). When it comes to machine learning and deep learning specifically, there are many libraries from which one can choose.</p><p>TensorFlow and Keras occupy the top two positions in terms of popularity, according to Google, and thus those two will be the focus of this post.</p><p>TensorFlow is the most famous library for deep learning out there. It was open-sourced by Google in late 2015 and since then it took off! You can realize how popular it is by visiting its repository on Github and seeing the strong community around it. Keras is an API built on top of TensorFlow and thus more user-friendly and easier to than TensorFlow. Oh, so should I learn Keras then? Well, hang on for a second!</p><p>If you are after building and testing neural networks quickly, then Keras is the clear choice. Keras is so powerful that you can build complex neural networks in few lines of code. For exmaple: to build 3 layers deep neural network with 15 neurons in the 1st layer, 8 in the 2nd and 1 in the final layer with traing data in: data and labels, all you need is this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/0*d2kBTJGZ78ybCFVY.png" /></figure><p>Even though Keras is a high-level API, you can almost implement anything with it now. However, TensorFlow is more flexible, clearly, when you are looking for more low-level flexibility. Also, TensorFlow comes with rich operation choices and control. You can tweak everything or develop your own from scratch. So, TensorFlow is superior for those who are doing research or developing specialized models. Also, TensorFlow has its debugger which shows the internal structure and states of its TensorFlow graphs.</p><p>In conclusion: If you are new to the deep learning field and/or looking to build neural networks fast, start with Keras; but if you are doing research and/or looking for low-level flexibility and complete control, go for TensorFlow.</p><p><em>Originally published at</em><a href="http://www.assawiel.com/blog"><em> assawiel.com/blog </em></a><em>on May 2, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bfe35d508a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cold Wallets and Hot Wallets in 300 Words!]]></title>
            <link>https://medium.com/@nezar.a/cold-wallets-and-hot-wallets-in-300-words-1593f50ab4b6?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1593f50ab4b6</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Sun, 02 Apr 2017 00:00:00 GMT</pubDate>
            <atom:updated>2018-10-09T19:22:14.811Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*0tK-wcFDzYl4hyiX.jpg" /></figure><p>You might have heard the terms cold wallet and hot wallets in the context of crypto currencies and not sure what the difference is. Here are the basics in 300 words.</p><p>In simple terms: hot wallets are connected to the internet while cold wallets are not. Thus, cold wallets are safer since hackers cannot get to them since they are not connected to the internet. However, they are not practical for our daily life. So, hot wallets that are less safe but convenient for our daily usage exist. Think using a safe at home and pocket wallet or checking vs saving account!</p><h3>Hot Wallets:</h3><p>when it comes to digital currency, there are two main types of hot wallets:</p><p>1) <strong>Accounts:</strong> within exchanges such as Coinbase or Bittrex are hot wallets since they are connected to the internet. If Coinbase or Bittrex got hacked, you could lose your money! Best practice is to move your funds after trading and only keep small amount, if any.</p><p>2) <strong>Software wallets:</strong> these are software applications that are downloaded and installed on your computer, such as <a href="https://www.exodus.io/">Exodus.io</a>. In this type of hot wallet, the software provider (such as Exodus) does not store your private keys on their servers. Rather, everything is on your computer and these wallets are designed to connect with different blockchains and support multiple digital currencies. While much safer than accounts on exchange platforms, a hacker could still reach your wallet if he/she could get access to your computer</p><h3>Cold Wallets:</h3><p>There are several kinds of could wallets. Here, let us address hardware wallets only.</p><p>Hardware wallets are physical devices (like a USB stick) that are kept offline and can be connected to a computer when a transaction is needed to take place. Each transaction has to be confirmed by pressing a button on the device. So, they are hacker-proof for all practical purposes. Some of the popular hardware wallets I found are: <a href="https://www.keepkey.com/">KeepKey</a> , <a href="https://www.ledgerwallet.com/products/ledger-nano-s">Ledger Nano S</a>, and <a href="https://trezor.io/">Trezor.io</a></p><p>So, my advice (at your own risk!) is that if you have a small amount of digital assets, a software wallet is enough. If you have more, then you should get a hardware wallet.</p><p><em>Originally published at</em><a href="http://www.assawiel.com/blog"><em> assawiel.com/blog </em></a><em>on April 2, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1593f50ab4b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Blockchain in Simple 300 Words?]]></title>
            <link>https://medium.com/@nezar.a/what-is-blockchain-in-simple-300-words-382c7832ea86?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/382c7832ea86</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[curiosity]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Sat, 04 Mar 2017 00:00:00 GMT</pubDate>
            <atom:updated>2018-10-09T19:42:19.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SiSuFFoX6G0yWZP6" /><figcaption>“tilt shift lens photo of stainless steel chain” by <a href="https://unsplash.com/@jjying?utm_source=medium&amp;utm_medium=referral">JJ Ying</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you have been following the technology news lately, it is likely you heard about the Blockchain technology and the Bitcoin digital currency. So, what is Blockchain in simple terms?</p><p>Let’s consider this question first: why do we use banks? Well, because we trust the bank as a middleman who keeps a register. If I want to lend you $100 dollars, I could ask the bank, which I trust, to send you the money from my account and keep a record of it or I could ask our friend Joe who I trust to give you the money, to whom I can come if you deny that I lent you $100 dollars. You see, I don’t know you, so I can’t trust you.</p><p>What if there is no bank or a person to trust? Or what if we just want to cut the middleman and keep the register ourselves? Here comes the Blockchain technology to answer this question!</p><p>If there are enough people (minimum 3) who want to keep a register themselves, then the Blockchain says: Every person must have a copy of the register and everybody writes down ALL the transactions that take place. And before any transaction is recorded, EVERYONE checks if there is enough balance in the account of the sender or if the transaction is legitimate to be carried out.</p><p>The register (which everybody has the exact copy of) consists of blocks (think papers). Everybody writes down the transactions from the beginning of his first page. When there is no space left in the page (all of them write in the exact way, so they run out of space at the same time), everybody puts the page in his Blockchain (file consists of blocks [i.e. papers] chained together). What is unique about it is that the written statement can’t be overwritten at all and thus can’t be forged.</p><p>While we used money transactions to be recorded in the Blockchain in this discussion, any type of register for anything can be carried out in the same way!</p><p><em>Originally published at</em><a href="http://www.assawiel.com/blog"> assawiel.com/blog<em> </em></a>on<em> March 4, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=382c7832ea86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Machine Learning in 300 Words?]]></title>
            <link>https://medium.com/@nezar.a/what-is-machine-learning-in-300-words-d42e7a56b587?source=rss-3799981825a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d42e7a56b587</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[curiosity]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Nezar Assawiel]]></dc:creator>
            <pubDate>Thu, 02 Feb 2017 00:00:00 GMT</pubDate>
            <atom:updated>2018-10-09T18:16:30.977Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*pMz1ghHQSXnZcxdi.jpg" /></figure><p>The terms artificial intelligence (AI) and machine learning (ML) are everywhere these days and I have noticed many people have asked me what they mean in casual conversations when they know I have some experience in this space . So, here is what you need to know in 300 words about ML.</p><p>ML is the study of computer programs that can learn by example. It is a subset of AI which is intelligence shown by machines (i.e. computer systems) as we, humans, strive to make such machines as intelligent as us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*OXHFb4y6qQnOzosj.jpg" /></figure><p>ML is used everywhere, from Google to give you fast and relevant search results to email to detect if an email is a spam or not or credit cards to detect if you a charge is fraud.</p><p>There are two types of ML:</p><p>1) Supervised ML: in which a computer program learns to predict target values from labeled examples. For example: if we want a program to detect if an image is of an apple or an orange, we feed the program examples of images of apples and oranges and let the program know which is which (these are called labeled examples or data). During this phase (called training) the program learns the rules by which it will recognize each fruit. Then, this trained program is used to detect if an image is of an orange or apple.</p><p>When the target values or labels are discrete, it is called classification (our apple/orange example is classification since we have 2 target values/labels: apple and orange). If the target values are continuous (say a price of house for example), it is called regression.</p><p>2) Unsupervised ML: in which a computer program finds structure in unlabeled data. For example: if we have a 100 news articles that we don’t know their topics and we want a program to “cluster” them, so articles about a certain topic are bout together (technology articles put together, politics articles put together…etc) There is another type of unsupervised ML in which we want to detect abnormal behavior and it is called “outlier detection”.</p><p>That is ML in 300 words!</p><p><em>Originally published at</em><a href="http://www.assawiel.com/blog"> assawiel.com/blog </a>on <em>February 2, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d42e7a56b587" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>