<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Isha Dagar</title>
    <description>The latest articles on DEV Community by Isha Dagar (@ishadagar).</description>
    <link>https://dev.to/ishadagar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F783293%2F463dcd6d-365c-4b46-b058-dbe4e3d3aa9b.jpeg</url>
      <title>DEV Community: Isha Dagar</title>
      <link>https://dev.to/ishadagar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ishadagar"/>
    <language>en</language>
    <item>
      <title>MNIST Digit Classification 			</title>
      <dc:creator>Isha Dagar</dc:creator>
      <pubDate>Sat, 29 Jan 2022 07:34:54 +0000</pubDate>
      <link>https://dev.to/ishadagar/mnist-digit-classification-5pi</link>
      <guid>https://dev.to/ishadagar/mnist-digit-classification-5pi</guid>
      <description>&lt;p&gt;MNIST dataset is a set of 70,000 small images of digits handwritten by high school students and employees of the US Census Bureau. Each image is labeled with the digit it represents.&lt;/p&gt;

&lt;p&gt;This set has been studied so much that it is often called the &lt;em&gt;"hello world"&lt;/em&gt; of Machine Learning.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The idea is to feed through the pixel values to the neural network and then have the neural network output, which number it actually thinks that image is.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;1. Load the data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now we're going to import dataset. MNIST dataset consists of 28 * 28 sized unique images of handwritten digits 0-9. Now, we are going to unpack the data to training and testing set.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Normalization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The data seems to vary from 0 to 255 for pixel data. So, we want to scale the data between 0 and 1 and that just make it easier for the network to learn.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Building model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is going to be Sequential type of model. It's a feed forward like the image we drew. The first layer will be the input layer. We want the image to be flat and not in multidimensional array. Now, we are going to have two hidden layers with 128 neurons and relu activation and the output layer will consist of 10 classifications and softmax activation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mifr5x12--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kla7890feo5ia3l6m01a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mifr5x12--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kla7890feo5ia3l6m01a.png" alt="Image description" width="880" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Training model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now we need to "compile" the model. This is where we pass the settings for actually optimizing/training the model we've defined.&lt;br&gt;
Next, we have our loss metric. Loss is a calculation of error. A neural network doesn't actually attempt to maximize accuracy. It attempts to minimize loss. Again, there are many choices, but some form of categorical crossentropy is a good start for a classification task like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J3Ygi8rY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hdxif9t01thvevstaur.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J3Ygi8rY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5hdxif9t01thvevstaur.png" alt="Image description" width="880" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Making predictions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Finally, with your model, you can save it super easily and make predictions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2OHtsi-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y975jtzyvm6sq09ua8s8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2OHtsi-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y975jtzyvm6sq09ua8s8.png" alt="Image description" width="880" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wnLj6aDT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m54o2d96mo0csieg1yh2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wnLj6aDT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m54o2d96mo0csieg1yh2.png" alt="Image description" width="728" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>programming</category>
    </item>
    <item>
      <title>Case Study: How does Netflix use Machine Learning? 			</title>
      <dc:creator>Isha Dagar</dc:creator>
      <pubDate>Wed, 05 Jan 2022 19:13:00 +0000</pubDate>
      <link>https://dev.to/ishadagar/case-study-how-does-netflix-use-machine-learning-2gh0</link>
      <guid>https://dev.to/ishadagar/case-study-how-does-netflix-use-machine-learning-2gh0</guid>
      <description>&lt;p&gt;Netflix uses &lt;em&gt;Netflix Recommendation Engine&lt;/em&gt; to show user content based on what they watch and their likes. Netflix uses a deep learning algorithm to understand the users likes and dislikes and then use this data and evaluate what content the user may like and recommend it to them.&lt;/p&gt;

&lt;p&gt;Recommender Pipeline:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Pre-processing&lt;/li&gt;
&lt;li&gt; Hyperparameter tuning&lt;/li&gt;
&lt;li&gt; Model training and prediction&lt;/li&gt;
&lt;li&gt; Post-processing&lt;/li&gt;
&lt;li&gt; Evaluation&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Data=&amp;gt;Machine Learning model=&amp;gt;Predictions&lt;br&gt;
User Preferences=&amp;gt;Recommender System=&amp;gt;Recommendations&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Collaborative filtering: Similar users like similar things.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;Content based filtering: User and item features.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pre-processing:&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zq-unbOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nb65712g21tswzb55htv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zq-unbOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nb65712g21tswzb55htv.png" alt="Image description" width="554" height="145"&gt;&lt;/a&gt;&lt;br&gt;
Let’s assume that we have data set that is dense enough to proceed.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Normalization:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Optimists = rate everything 4 or 5&lt;br&gt;
Pessimists=rate everything 1 or 2&lt;br&gt;
Need to normalize ratings by accounting for user and item bias.&lt;br&gt;
Mean normalization:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;subtract bi from each user’s rating for given item i.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yuBqrztq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tlvhps3hpvih0y6f12ov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yuBqrztq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tlvhps3hpvih0y6f12ov.png" alt="Image description" width="880" height="220"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pick a Model:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Matrix Factorization:&lt;/em&gt;&lt;br&gt;
Factorize the user-item matrix to get 2 latent factor matrices:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User-factor matrix&lt;/li&gt;
&lt;li&gt;Item factor matrix
Missing ratings are predicted from the inner product of these two factor matrices.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VS0XDE4V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ey15je5ooc1gh7jawtfi.png" alt="Image description" width="492" height="89"&gt;
Algorithms that perform matrix factorization:&lt;/li&gt;
&lt;li&gt;Alternating Least Squares (ALS)&lt;/li&gt;
&lt;li&gt;Stochastic Gradient Descent (SGD)&lt;/li&gt;
&lt;li&gt;Singular Value Decomposition (SVD)&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pick an Evaluation Metric:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Precision at K:&lt;/em&gt;&lt;br&gt;
Looks at the top K recommendations and calculates what proportion of those recommendations were relevant to a user. We will be focusing on the top 10 recommendations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hyperparameter tuning&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alternating Least Square’s Hyperparameters&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;K (# of factors)&lt;/li&gt;
&lt;li&gt;Lambda (regularization parameter)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Goal: Find the hyperparameter that give the best precision at 10.&lt;/p&gt;

&lt;p&gt;Grid Search: Iterates over a number set of combinations of K and lambda. So, we basically run the model and evaluate it for each combination of lambda and K and see which of them gives us the best precision at 10.&lt;/p&gt;

&lt;p&gt;Random Search: It just randomly selects values of lambda and K and evaluates that several times. This approach is less exhaustive and more effective than grid search.&lt;/p&gt;

&lt;p&gt;Sequential Model-Based Optimization: It’s basically a smarter way of tuning your hyper parameters because it takes into consideration the results of your previous iterations when you sample hyper parameters and your current iteration.&lt;br&gt;
You can consider using tools like sidekick optimize, hyper opt or metric optimization engine which was developed by Yelp.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Model Training&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can train this model with these optimal hyperparameters to get our predicted ratings and we can use these results to generate our recommendations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Post-processing&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sort predicted ratings and get top N.&lt;br&gt;
Filter out items that a user has already purchased, watched, interacted with.&lt;br&gt;
Item-item recommendations&lt;br&gt;
-Use a similarity metric (e.g., cosine similarity)&lt;br&gt;
-“Because you watched Movie X”&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Evaluation&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you can do A|B testing or usability testing where you get actual feedback from real users, that is the best signal that you have a good recommender but in many cases that’s not possible. So, we’re going to have to do offline evaluation.&lt;/p&gt;

&lt;p&gt;In traditional ML we split our dataset in half to create a training set and a validation set but this isn’t work for recommender models because the model won’t work if you train all your data on a separate user population then the validation set. So, for recommenders we actually mask random interactions in our matrix and use this as our training set. So, we pretend that we don’t know a user’s rating of a movie, but we actually do and we can compare the predicted rating with the actual rating and that’s our way of calculating precision at 10 or any metric we want in this case.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---pn5HsAE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26nywtsq1kmu4c6og308.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---pn5HsAE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26nywtsq1kmu4c6og308.png" alt="Image description" width="653" height="518"&gt;&lt;/a&gt;&lt;br&gt;
Precision and recall are very popular metrics for recommender systems and they’re both information retrieval metrics.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>algorithms</category>
      <category>programming</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Jupyter Notebook v/s Google Colab 			</title>
      <dc:creator>Isha Dagar</dc:creator>
      <pubDate>Sun, 02 Jan 2022 12:01:17 +0000</pubDate>
      <link>https://dev.to/ishadagar/jupyter-notebook-vs-google-colab-c82</link>
      <guid>https://dev.to/ishadagar/jupyter-notebook-vs-google-colab-c82</guid>
      <description>&lt;p&gt;I have worked on both Google Colab and Jupyter notebook so I think I would be able to explain more clearly the difference between the two and which one you should use.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Jupyter is the open source project on which Colab is based. Colab allows you to use and share Jupyter notebooks with others without having to download, install, or run anything.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Google Colab:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Google Colab comes with collaboration backed in the product. As Colab is a Web App hosted by Google, you need Internet connection to access it and run code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It runs in cloud and runs your program on the server side so you don’t need to worry about downloading packages locally . &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They give you a free virtual machine that has about 12 Gb of RAM which is pretty descent, but they also give access to a GPU card which is much more performing and much faster. You can access free GPUs for max 12 hours. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The notebooks are saved to your Google Drive account.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Jupyter Notebook:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Jupyter notebook run on a local host so it works offline.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You have direct access to your file system and with your scripts you use all the storage of your disk.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The hardware is your PC's RAM, Disk, CPU and GPU.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You have to install everything by yourself via pip or other package managers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Jupyter notebook = Running code, taking notes , show &lt;br&gt;
 multimedia interactivity    +     Read-eval-print  loop Terminal, Kernal with the frontend interfaces.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Google colab = Jupyter notebook   +   Collaboration, additional hardware cloud based&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Which one is better?
&lt;/h2&gt;

&lt;p&gt;Google colab allows you to share your work with other developers. So, not only you can push your work directly to GitHub, but you can share the notebook itself to developers and they can run the cell and get the same result as you are getting because the environment it is running on is consistent as it is a remote machine which would not be the case if you were doing a local development on jupyter notebook.&lt;br&gt;
If you’re just playing around or working on personal projects, Jupyter will work fine. If you want to build commercial-grade models and deploy them to production, Codelab provides the full-lifecycle approach that you’d need.&lt;br&gt;
If you are in a non-programming job, and you don't want to install everything on your work computer to get it set up for Jupyter, you can just start working with Google Colab without having to do any installation and share your scripts with non-technical co-workers who wouldn't be able to install anything themselves.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>jupyter</category>
    </item>
    <item>
      <title>Top 5 languages for Machine Learning</title>
      <dc:creator>Isha Dagar</dc:creator>
      <pubDate>Thu, 30 Dec 2021 21:19:41 +0000</pubDate>
      <link>https://dev.to/ishadagar/top-5-languages-for-machine-learning-5c57</link>
      <guid>https://dev.to/ishadagar/top-5-languages-for-machine-learning-5c57</guid>
      <description>&lt;p&gt;In machine learning, there is no best language as such. Each language is good where it fits best but there are more suitable programming languages that are more appropriate for machine learning tasks than others.&lt;/p&gt;

&lt;p&gt;Such as, most of the software engineers use Java for machine learning applications like security and threat detection whereas other prefer to use Python for NLP and LSTM problems. Some also prefer to use R or Python for sentiment analysis tasks. Software engineers with a background in Java development transitioning into machine learning sometimes continue to use Java as the programming language in machine learning job roles. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Python :&lt;/strong&gt; Python leads all the other languages. More than 60% of machine learning developers are using Python and prioritizing it for development because python is easy and versatile to learn. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;"While Python has been around for decades, the demand for Python skills in 2022 will continue growing exponentially thanks to its use in the booming industries of data science, machine learning and AI," said Ryan Desmond, co-founder and lead instructor at CodingNomads."In addition, Python is considered one of the easiest, most powerful, and most versatile languages to learn, making it popular amongst companies, developers, and aspiring developers."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Python has many awesome visualization packages and useful core libraries like Numpy, scipy, pandas, matplotlib, seaborn, sklearn which really makes your work very easy and empower the machines to learn.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. R :&lt;/strong&gt; R is an open-source programming platform that includes a wide range of libraries and frameworks. Several big tech companies use the R language to run their businesses and with the increasing demand for machine learning and data science in 2021, it is quite evident that R will be in-demand in 2022 and the upcoming years. It is popular in implementing machine learning tasks like regression, classification, and decision tree formation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Java :&lt;/strong&gt; Java is considered harder to learn than Python but easier than C or C++  because Java is improved on C, and Python is improved on Java. If you learn java then learning something like Python will be much easier. Java provides many good environments like Weka, Knime, RapidMiner, Elka which used to perform machine learning tasks using graphical user interfaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Javascript :&lt;/strong&gt; Used on more than 97% of the world's websites, JavaScript allows you to set up dynamic and interactive content, animated graphics and other complex features on the web. It's also the most popular language among contributors on GitHub. Javascript is also so popular in ML that high-profile projects like Google’s Tensorflow.js are based on JavaScript. If you are a master of Javascript then literally you can do everything from full-stack to machine learning and NLP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. C++ :&lt;/strong&gt; C++ has become a go-to programming language for analysts and researchers. Besides it’s popularity in game development domain, many powerful libraries such as TensorFlow and Torch are implemented in the C++ programming language. Therefore C++ and machine learning is indeed a great combination. &lt;/p&gt;

&lt;p&gt;Happy Learning.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
