<?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 Bijan Daei on Medium]]></title>
        <description><![CDATA[Stories by Bijan Daei on Medium]]></description>
        <link>https://medium.com/@bdaei?source=rss-fbf3565dc0a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tzBLfjDiISUmVLSHGqQkgg.jpeg</url>
            <title>Stories by Bijan Daei on Medium</title>
            <link>https://medium.com/@bdaei?source=rss-fbf3565dc0a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:44:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bdaei/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[A Layman’s Intro to Machine Learning — Part 3: Neural Networks and Their Applications]]></title>
            <link>https://medium.com/@bdaei/a-laymans-intro-to-machine-learning-part-3-neural-networks-and-their-applications-e88cf08c1d21?source=rss-fbf3565dc0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e88cf08c1d21</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Bijan Daei]]></dc:creator>
            <pubDate>Sun, 07 May 2023 18:42:40 GMT</pubDate>
            <atom:updated>2023-05-07T18:42:40.674Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Layman’s Intro to Machine Learning — Part 3: Neural Networks and Their Applications</h3><p><em>In the first two parts of this series, we introduced AI, machine learning, and deep learning, and then explored some basic terminology and different types of learning. In this third part, we’ll dive into one of the most important and widely-used tools in machine learning: </em><strong><em>neural networks</em></strong><em>. By the end of this article, you’ll have a better understanding of how neural networks work, their different types, and their various applications.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Pbg3qudkxqGR852P" /></figure><h3>Introduction to Neural Networks: A Journey Through Time</h3><p>Welcome back, dear readers! Today, we’ll embark on an exciting adventure through the history of neural networks. Just like our brains are the core of our thinking and decision-making abilities, neural networks have been the center of attention in the world of artificial intelligence since their humble beginnings in the 1940s.</p><p>Our story begins with the work of Warren McCulloch and Walter Pitts, who, in 1943, proposed the first artificial neuron, a simple yet powerful concept¹. Fast forward to the 1960s, and researchers like Frank Rosenblatt took the idea further with the development of the perceptron, sparking more interest in neural networks [2].</p><p>But wait, there’s more! In the 1980s, Geoffrey Hinton and his team introduced the world to backpropagation, a learning algorithm that changed the game for neural networks [3]. This breakthrough laid the foundation for many modern neural network architectures we see today.</p><p>However, the journey wasn’t all smooth sailing. Limited computational power and the lack of large-scale labeled datasets slowed progress. But fear not! The 2010s brought us more powerful computing hardware (hello, GPUs!) and large datasets like ImageNet [4], igniting the deep learning revolution and propelling neural networks into the spotlight.</p><p>Today, neural networks are the rockstars of machine learning, showing off their skills in tasks like image and speech recognition, natural language understanding, and even complex strategy games like chess and Go [5]. The future of AI seems brighter than ever, as we continue exploring the potential of neural networks.</p><p>In the following sections, we’ll take a closer look at the ins and outs of neural networks, their various types, and their shining moments in different applications. Buckle up and get ready to dive deep into the fascinating world of neural networks!</p><h3>The Building Blocks: Neurons, Layers, and Neural Network Shenanigans</h3><p>Before diving into the nitty-gritty of neural networks, let’s first get acquainted with their basic building blocks: neurons and layers. In this section, we’ll unravel the mysteries of these vital components and discover how they come together to form the intricate structure of neural networks.</p><h4>Artificial Neurons: The Brainy Bits</h4><p>The concept of artificial neurons, also known as nodes or units, took inspiration from the good ol’ human brain. Just like biological neurons receive input signals, process them, and transmit the output to their neighbors, artificial neurons in a neural network do pretty much the same thing. They take in numerical inputs, do some fancy math, and produce an output value that’s passed on to other neurons in the network [1].</p><p>To be more specific, artificial neurons follow a two-step dance routine. First, they multiply each input by a corresponding weight and sum up the results. Next, they pass this weighted sum through an activation function, which determines the neuron’s output. Activation functions can be simple step functions or more intricate non-linear ones like the sigmoid or ReLU function, helping neural networks learn all sorts of fascinating patterns and relationships [6].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNCkmAQ9QEUzp3D8kPYHIg.png" /><figcaption>A Neuron: Just a Math Whiz in Disguise</figcaption></figure><h4>Layers in Neural Networks: A Neatly Organized Party</h4><p>Neural networks are organized in layers, with each layer hosting a group of neurons. Typically, there are three types of layers in a neural network: input, hidden, and output layers [7].</p><p>The input layer is the network’s friendly receptionist, welcoming the initial data and passing it on to the hidden layers. Data points are represented as numerical values or encoded representations, as we’ve discussed in a previous article of this series.</p><p>Hidden layers are where all the fun happens. They consist of multiple neurons that process the input data, learn fascinating patterns, and pass the transformed data to the next layer. A neural network can have one or more hidden layers, and the number of neurons in each layer can vary depending on the complexity of the problem at hand.</p><p>Lastly, the output layer is the grand finale, producing the neural network’s final result. It translates the processed information from the hidden layers into something more digestible, like a probability score, a class label, or a continuous value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QNTK3WkfBOijho-c.png" /><figcaption>The Perfect Arrangement for a Neural Network Soiree</figcaption></figure><p>By combining neurons and layers, neural networks create powerful learning machines capable of tackling complex problems. The precise organization of neurons and layers, known as the network architecture, plays a crucial role in determining the network’s learning capacity and performance [8].</p><h3>How Neural Networks Learn: Backpropagation and Gradient Descent</h3><p>Neural networks might not attend universities or take online courses, but they sure know how to learn. The magical duo behind their learning process is “backpropagation” and “gradient descent” [6]. Let’s unravel this mystery, and I promise to keep it lighthearted and witty, just like your favorite sitcom.</p><h4>Backpropagation: Learning from Faux Pas</h4><p>Ever had a conversation and uttered something you immediately wished you could take back? We all have those moments, and we learn from them. That’s what backpropagation is all about for a neural network.</p><p>When the neural network makes a “prediction” (think of it as an accidental slip of the tongue), it might not be spot on. So, the network tries to learn from its blunders by backtracking through the layers and adjusting the weights (like tuning a guitar). This process repeats until the network becomes a smooth talker, nailing the predictions [8].</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2FBitesizedWeeBlacklemur&amp;display_name=Gfycat&amp;url=https%3A%2F%2Fthumbs.gfycat.com%2FBitesizedWeeBlacklemur-mobile.mp4&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="1280" height="720" frameborder="0" scrolling="no"><a href="https://medium.com/media/0fe6f54278a9eb8548c9a9c1ffd31bf2/href">https://medium.com/media/0fe6f54278a9eb8548c9a9c1ffd31bf2/href</a></iframe><h4>Loss Function: Feeling the Burn</h4><p>In the neural network’s fitness journey, there’s a measure of how “in shape” it is: the loss function. Just like tracking your calories, the loss function quantifies the network’s errors in making predictions. The ultimate goal? Minimize the loss, just like you’d aim to shed those extra pounds.</p><h4>Gradient Descent: A Step in the Right Direction</h4><p>Picture yourself at the top of a hill, and you want to reach the bottom. It’s dark, and you forgot your flashlight. Bummer! But, you can feel the slope beneath your feet. To find the lowest point, you would take small steps in the direction where the slope feels steepest, right? That’s gradient descent for you.</p><p>In neural networks, gradient descent helps find the optimal weights by minimizing the error between the predicted output and the actual output, as quantified by the loss function [8]. It does this by taking small “steps” to adjust the weights in the direction that reduces the error the most. Mathematically speaking, it’s all about finding the minimum of the loss function by following the negative gradient. It’s like learning to dance; with each step, the network gets closer to nailing that perfect move.</p><h4>Batch Gradient Descent: Divide and Conquer</h4><p>Training a neural network can be computationally expensive, especially when dealing with large datasets. To make the process more efficient, we have batch gradient descent. It’s like hosting a potluck dinner instead of cooking for everyone yourself. By splitting the training data into smaller “batches,” the network updates its weights more frequently, leading to faster convergence [9].</p><h4>Weights: The Parameters of the Network</h4><p>Just like the settings on your favorite coffee machine, the weights in a neural network are its parameters. These weights are the key to translating inputs into meaningful outputs. During the training process, backpropagation and gradient descent work hand in hand to fine-tune these weights until the network becomes an expert in making predictions.</p><p>In conclusion, neural networks learn by combining backpropagation and gradient descent, which allow them to adjust their weights based on the errors they make, as quantified by the loss function. With enough training, these networks can learn to recognize patterns and make accurate predictions, even outperforming humans in some cases. So, the next time you’re at a social gathering, and you make a little faux pas, just remember, even neural networks need time and practice to get things right!</p><h3>Different Types of Neural Networks</h3><p>When it comes to neural networks, one size does not fit all. Depending on the task at hand, different neural network architectures can be more suitable. So, let’s take a stroll through the bustling metropolis of neural networks and explore some of the popular types that are transforming the world of artificial intelligence.</p><h4>Feedforward Neural Networks (FF)</h4><p>Imagine a conveyor belt carrying information from input to output, with no detours or loops. That’s the essence of feedforward neural networks, the simplest form of neural networks. They are like the trusty old bicycle of the AI world, perfect for straightforward tasks such as regression (e.g., predicting house prices based on features like size and location) and classification (e.g., determining if an email is spam or not) [10].</p><h4>Convolutional Neural Networks (CNNs)</h4><p>Picture CNNs as the AI equivalent of a world-class detective specializing in visual cases. They’re designed to process grid-like data, such as images, and are especially effective for tasks like image recognition and classification (e.g., identifying objects in a photo or detecting handwritten digits) [8]. CNNs use convolutional layers to detect local patterns, which makes them akin to a magnifying glass that scrutinizes every little detail.</p><h4>Recurrent Neural Networks (RNNs)</h4><p>Enter the world of RNNs, the neural network’s answer to processing sequences of data. RNNs maintain an internal state, much like a memory bank, that captures information from previous time steps. This ability makes them ideal for tasks like natural language processing (e.g., sentiment analysis), speech recognition (e.g., transcribing spoken words), and time-series prediction (e.g., forecasting stock prices) [11].</p><h4>Long Short-Term Memory (LSTM) Networks</h4><p>LSTMs are the upgraded version of RNNs, designed to handle long-range dependencies more effectively [12]. With their sophisticated memory cell architecture, they excel in tasks such as machine translation (e.g., translating English text to French), text generation, and speech recognition [13].</p><h4>Gated Recurrent Unit (GRU) Networks</h4><p>GRUs are like the younger sibling of LSTMs — simpler and more computationally efficient, but still quite capable [14]. They’ve proven to be a popular choice for natural language processing and other applications involving sequential data, performing comparably to LSTMs on various tasks [15].</p><h4>Transformer Networks</h4><p>Transformers are the rising stars of the AI world, revolutionizing natural language processing [16]. They use self-attention mechanisms to process input sequences in parallel, leading to more efficient training and improved performance on tasks like machine translation, text summarization, and language modeling. If you’ve heard of BERT, GPT, or T5, you’re already familiar with the power of Transformer networks [17].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PSRmv3Au4K1X4CEl.jpg" /><figcaption>Transformers arrange difference types of layers into different modules.</figcaption></figure><p>In summary, the diverse landscape of neural networks offers a wide array of architectures, each with its unique strengths and applications. By understanding the capabilities of these networks, researchers and engineers can choose the most suitable architecture for the problem at hand, pushing the boundaries of what’s possible with machine learning.</p><h3>Applications of Neural Networks in Real Life</h3><p>Neural networks are like the superheroes of the artificial intelligence world, swooping in to save the day in a multitude of real-life applications. They’re versatile, adaptable, and let’s face it, pretty cool. Let’s take a tour of some of their greatest hits, from image recognition to playing games, and wrap up with a look at the rockstars of today — the large language models (LLMs).</p><h4>Picture Perfect: Image and Speech Recognition</h4><p>Ever used a photo app that magically recognized your friends’ faces and tagged them? Or how about talking to a voice assistant that understands your command to play your favorite song? These everyday marvels are made possible by neural networks, specifically CNNs, which excel at tasks like image and speech recognition [18].</p><h4>The Art of Conversation: Natural Language Processing</h4><p>Neural networks have a way with words, too. They’re behind the scenes powering natural language processing (NLP) tasks, like sentiment analysis, machine translation, and text summarization [13]. So, the next time you’re using an app to translate a menu in a foreign language, you can thank neural networks for coming to your rescue.</p><h4>Money Matters: Financial Forecasting</h4><p>Neural networks are savvy with finances as well. They can predict stock prices, analyze market trends, and even detect potential fraud, making them valuable tools for investors and financial institutions alike [19].</p><h4>Doctor, Doctor: Medical Diagnosis</h4><p>When it comes to medical diagnosis, neural networks are like a superpowered stethoscope. They can analyze medical images, identify patterns in patient data, and predict disease outcomes, helping doctors make more informed decisions and potentially saving lives [20].</p><h4>Game On: Mastering Chess and Go</h4><p>Remember when IBM’s Deep Blue defeated chess grandmaster Garry Kasparov in 1997? Neural networks have come a long way since then. Today, they’re capable of mastering games like chess and Go, with programs like AlphaGo and AlphaZero showing us just how powerful these learning machines can be [21].</p><h4>Language Wizards: Large Language Models (LLMs)</h4><p>Last but certainly not least, let’s talk about the headliners of the AI world — large language models (LLMs). These neural network prodigies, like OpenAI’s GPT-3, can generate human-like text, answer questions, and even compose poetry [22]. They’re pushing the boundaries of what we thought possible, transforming industries, and sparking endless debates on ethics and AI’s role in society.</p><p>So there you have it — from recognizing faces to penning poems, neural networks are making a splash in real-life applications across the board. With each new breakthrough, we’re witnessing the extraordinary potential of these learning machines, and who knows what wonders they’ll perform next!</p><h3>Challenges and Limitations of Neural Networks — It’s Not All Sunshine and Rainbows</h3><p>Let’s take a step back and acknowledge that neural networks, despite being absolute rock stars in some areas, have their fair share of flaws. It’s like that friend who’s great at cooking but somehow always ends up burning the cookies. Here’s a rundown of some challenges and limitations that make neural networks a tad less perfect:</p><ol><li><strong>The Hunger for Data</strong>: Like a ravenous teenager, neural networks have an insatiable appetite for data. They need truckloads of labeled data to train effectively, and acquiring that much data can be time-consuming and expensive. It’s like trying to find enough ingredients for a colossal lasagna during a grocery shortage [23].</li><li><strong>Overfitting, A Neural Network’s Achilles’ Heel</strong>: Overfitting is when a neural network becomes too good at memorizing the training data and fails to generalize well to new, unseen data. It’s like cramming for an exam and remembering every word in the textbook but struggling to apply that knowledge to real-life situations [24].</li><li><strong>The “Black Box” Problem</strong>: Ever found yourself staring at a magic trick, wondering how on earth it works? That’s how we feel about neural networks sometimes. They can be difficult to interpret, and understanding their inner workings can be quite a challenge. This “black box” problem makes it hard to trust their decisions, especially in critical applications like healthcare or finance [25].</li><li><strong>Adversarial Attacks</strong>: This one’s a bit like a prank war gone wrong. Neural networks can be fooled by adversarial examples — small, carefully crafted changes to input data that cause the network to make incorrect predictions. These vulnerabilities can be exploited by bad actors and raise concerns about their reliability and security [26].</li></ol><p>So, while neural networks have undoubtedly proven their mettle in various domains, it’s essential to recognize their limitations and work towards addressing these challenges. After all, nobody’s perfect, not even our AI-powered friends!</p><h3>Summary of Part 3</h3><p>We embarked on a journey through the captivating world of neural networks in this installment of the series. We’ve demystified the building blocks of these networks — neurons and layers — and explored how they learn through backpropagation and gradient descent.</p><p>We also discussed various types of neural networks, including feedforward, convolutional, and recurrent networks, and looked at their applications in real life, such as language models, image recognition, and more. Moreover, we touched upon the challenges and limitations of neural networks, and how researchers are working to overcome them.</p><p>This whirlwind tour provided a solid foundation to appreciate the fascinating world of neural networks and their potential to transform our lives.</p><h3>What’s Next?</h3><p>In the upcoming part of this series, we’ll delve into the world of transformers and language models, which have revolutionized the AI landscape. We’ll explore the inner workings of these powerful models, their applications, and how they’ve become a game-changer in the field of natural language processing and beyond.</p><p><em>If you enjoyed this article, please follow me here and share it with your friends. Your support is truly appreciated and helps me continue producing content like this. Thank you!</em></p><h3>References for Nerds</h3><p>[1] <a href="https://link.springer.com/article/10.1007/bf02478259">McCulloch, W. S., &amp; Pitts, W. (1943). A logical calculus of the ideas immanent in nervous activity. The Bulletin of Mathematical Biophysics, 5(4), 115–133</a>.</p><p>[2] <a href="https://www.semanticscholar.org/paper/The-perceptron%3A-a-probabilistic-model-for-storage-Rosenblatt/5d11aad09f65431b5d3cb1d85328743c9e53ba96">Rosenblatt, F. (1958). The perceptron: A probabilistic model for information storage and organization in the brain. Psychological Review, 65(6), 386–408</a>.</p><p>[3] <a href="https://www.nature.com/articles/323533a0">Rumelhart, D. E., Hinton, G. E., &amp; Williams, R. J. (1986). Learning representations by back-propagating errors. Nature, 323(6088), 533–536.</a></p><p>[4] <a href="https://ieeexplore.ieee.org/document/5206848">Deng, J., Dong, W., Socher, R., Li, L., Li, K., &amp; Fei-Fei, L. (2009). ImageNet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition (pp. 248–255). IEEE.</a></p><p>[5] <a href="https://pubmed.ncbi.nlm.nih.gov/29052630/">Silver, D., Schrittwieser, J., Simonyan, K., Antonoglou, I., Huang, A., Guez, A., … &amp; Hassabis, D. (2017). Mastering the game of Go without human knowledge. Nature, 550(7676), 354–359.</a></p><p>[6]<a href="https://www.deeplearningbook.org/"> Goodfellow, I., Bengio, Y., &amp; Courville, A. (2016). Deep Learning. MIT Press.</a></p><p>[7] <a href="https://www.amazon.ca/Introduction-Neural-Networks-Java-2nd/dp/1604390085">Heaton, J. (2005). Introduction to Neural Networks with Java. Heaton Research, Inc</a>.</p><p>[8] <a href="https://www.nature.com/articles/nature14539">LeCun, Y., Bengio, Y., &amp; Hinton, G. (2015). Deep learning. Nature, 521(7553), 436–444</a>.</p><p>[9] <a href="https://arxiv.org/abs/1609.04747">Ruder, S. (2016). An overview of gradient descent optimization algorithms. arXiv preprint arXiv:1609.04747.</a></p><p>[10] <a href="https://global.oup.com/academic/product/neural-networks-for-pattern-recognition-9780198538646?cc=ca&amp;lang=en&amp;">Bishop, C. M. (1995). Neural networks for pattern recognition. Oxford University Press.</a></p><p>[11] <a href="https://www.sciencedirect.com/science/article/abs/pii/036402139090002E">Elman, J. L. (1990). Finding structure in time. Cognitive Science, 14(2), 179–211.</a></p><p>[12] <a href="https://direct.mit.edu/neco/article-abstract/9/8/1735/6109/Long-Short-Term-Memory?redirectedFrom=fulltext">Hochreiter, S., &amp; Schmidhuber, J. (1997). Long short-term memory. Neural Computation, 9(8), 1735–1780</a>.</p><p>[13] <a href="https://proceedings.neurips.cc/paper/2014/file/a14ac55a4f27472c5d894ec1c3c743d2-Paper.pdf">Sutskever, I., Vinyals, O., &amp; Le, Q. V. (2014). Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems (pp. 3104–3112)</a>.</p><p>[14] <a href="https://aclanthology.org/D14-1179/">Cho, K., Van Merriënboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H., &amp; Bengio, Y. (2014). Learning phrase representations using RNN encoder-decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP) (pp. 1724–1734)</a>.</p><p>[15] <a href="https://arxiv.org/abs/1412.3555">Chung, J., Gulcehre, C., Cho, K., &amp; Bengio, Y. (2014). Empirical evaluation of gated recurrent neural networks on sequence modeling. In NIPS 2014 Deep Learning and Representation Learning Workshop</a>.</p><p>[16] <a href="https://proceedings.neurips.cc/paper_files/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf">Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., &amp; Polosukhin, I. (2017). Attention is all you need. In Advances in Neural Information Processing Systems (pp. 5998–6008)</a>.</p><p>[17] <a href="https://aclanthology.org/N19-1423/">Devlin, J., Chang, M. W., Lee, K., &amp; Toutanova, K. (2018). BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers) (pp. 4171–4186)</a>.</p><p>[18] <a href="https://proceedings.neurips.cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf">Krizhevsky, A., Sutskever, I., &amp; Hinton, G. E. (2012). Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems (pp. 1097–1105)</a>.</p><p>[19] <a href="https://www.sciencedirect.com/science/article/abs/pii/S0957417411002740">Guresen, E., Kayakutlu, G., &amp; Daim, T. U. (2011). Using artificial neural network models in stock market index prediction. Expert Systems with Applications, 38(8), 10389–10397</a>.</p><p>[20] <a href="https://pubmed.ncbi.nlm.nih.gov/28778026/">Litjens, G., Kooi, T., Bejnordi, B. E., Setio, A. A. A., Ciompi, F., Ghafoorian, M., … &amp; Sánchez, C. I. (2017). A survey on deep learning in medical image analysis. Medical Image Analysis, 42, 60–88</a>.</p><p>[21] <a href="https://www.nature.com/articles/nature16961">Silver, D., Huang, A., Maddison, C. J., Guez, A., Sifre, L., Van Den Driessche, G., … &amp; Dieleman, S. (2016). Mastering the game of Go with deep neural networks and tree search. Nature, 529(7587), 484–489</a>.</p><p>[22] <a href="https://proceedings.neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf">Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., … &amp; Agarwal, S. (2020). Language models are few-shot learners. In Advances in Neural Information Processing Systems (pp. 1877–1901)</a>.</p><p>[23] <a href="https://ieeexplore.ieee.org/document/8237359">Sun, C., Shrivastava, A., Singh, S., &amp; Gupta, A. (2017). Revisiting unreasonable effectiveness of data in deep learning era. In Proceedings of the IEEE International Conference on Computer Vision (pp. 843–852)</a>.</p><p>[24] <a href="https://www.taylorfrancis.com/books/mono/10.1201/9781315382159/first-course-machine-learning-mark-girolami-simon-rogers">Hawkins, J. (2004). Overfitting. In A First Course in Machine Learning (pp. 127–132). CRC Press</a>.</p><p>[25] <a href="https://arxiv.org/abs/1708.08296">Samek, W., Wiegand, T., &amp; Müller, K. R. (2017). Explainable artificial intelligence: Understanding, visualizing and interpreting deep learning models. ITU Journal: ICT Discoveries, 1(1), 1–13</a>.</p><p>[26]<a href="https://arxiv.org/abs/1312.6199"> Szegedy, C., Zaremba, W., Sutskever, I., Bruna, J., Erhan, D., Goodfellow, I., &amp; Fergus, R. (2013). Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e88cf08c1d21" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Layman’s Intro to Machine Learning — Part 2]]></title>
            <link>https://medium.com/@bdaei/a-laymans-intro-to-machine-learning-part-2-42c6fec4bf34?source=rss-fbf3565dc0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/42c6fec4bf34</guid>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[course]]></category>
            <dc:creator><![CDATA[Bijan Daei]]></dc:creator>
            <pubDate>Sun, 21 Nov 2021 23:10:48 GMT</pubDate>
            <atom:updated>2022-03-02T16:52:51.439Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Layman’s Intro to Machine Learning — Part 2: Terminology and Different types of learning</h3><p><em>This is the second part of a multi-part series I am writing to introduce machine learning to a potentially wide audience. If you like it please </em><strong><em>share </em></strong><em>this article on social media and </em><strong><em>follow </em></strong><em>me </em><a href="https://medium.com/@bdaei"><em>here </em></a><em>and on </em><a href="https://twitter.com/bdaei"><em>Twitter</em></a><strong><em>. It’s the best way to support my work. Thanks!</em></strong></p><p>In <a href="https://medium.com/@bdaei/a-layman-into-to-machine-learning-part-1-c3f233605f73">part 1</a> of this series I tried to introduce you to AI, machine learning and deep learning. In this part we are going to learn about a few basic concepts in machine learning. We start with some important terminology: models, features, labels and examples. Then we will talk about different types of machine learning including Supervised and Unsupervised learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*PRi4v7umfDi1L6uE" /></figure><h3>Important Machine Learning Terminology</h3><p>In this section, I am going to briefly talk about a few important terms that are used frequently in machine learning. To help explain these terms, I will use a sample dataset.</p><h4>Dataset</h4><p>A dataset is a list of observations about a phenomenon. Our example is about observations made on patients with heart failure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*pX8B3G-0uNhLW1rgWgrnrg.png" /><figcaption>a sample <strong>dataset</strong></figcaption></figure><p>I downloaded this dataset from <a href="https://www.kaggle.com/fedesoriano/heart-failure-prediction">kaggle.com</a>, but removed some of the columns to make it simpler. When a patient with potential heart failure visits a hospital, doctors make some observations and record the results. In this picture you see the name of these observations: Age, Sex, RestingBP (resting blood pressure), Cholesterol, MaxHR (maximum heart rate) and HeartDisease (the diagnosis made by doctors).</p><h4>Models</h4><p>In the science of statistics, a model is a mathematical representation of the relationship between one or more <em>variables</em>. For example, a model can represent the relationship between age, sex, blood pressure, cholesterol level and maximum heart rate of a person and risk of heart disease. In this model, age, sex, blood pressure, cholesterol level and maximum heart rate are <em>input variables</em> to the model, and risk of heart disease is the <em>output variable</em>. The details of how the output is calculated based on the inputs is not relevant here. There are many different approaches available for doing that. Machine learning is one of these approaches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*kvTXpImJ-po6CRuldREXzQ.png" /><figcaption>A model represents a relationship between input (feature) variables and outputs.</figcaption></figure><h4>Features</h4><p>Feature is just another word for model inputs. In machine learning, features are numbers, or <a href="https://en.wikipedia.org/wiki/Row_and_column_vectors">vectors of numbers</a>. In our sample medical dataset above, all features have numerical values (Sex is shown with M and F but we can easily replace that with 0 and 1). Models define mathematical relationships. Therefore, models cannot accept non-numerical data. But what if your data is non-numeric? What if we do an electrocardiogram test and the results are words like <em>Normal</em>, <em>ST</em>, <em>LVT</em>? How can we feed things like pictures, a paragraph of text, or names of objects into a model? We convert these <em>values</em> into numbers using a set of techniques called <strong>encoding </strong>which will be covered in later parts of this series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*s3ABXkIv6M6R6W5TMq1cbg.png" /><figcaption>Features are inputs to the model</figcaption></figure><h4>Labels</h4><p>In most machine learning models, we call the output of the model a label. In our sample dataset, the result of diagnosis is the label. The label is also a number. Sometimes it is a binary (1 or 0, true or false, yes or no), sometimes it is a probability (a real number between 0.0 and 1.0) that represents something like risk or probability of a specific outcome, and sometimes it is an unbound value, like the price of a stock.</p><p>Back to our sample dataset. After building the model successfully, when we present it with data, it should be able tell us if the patient has heart disease or not with an acceptable level of certainty. We will see later that interpreting model outputs is not an easy job and it can come with a lot of caveats!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*eQc_rJ8hrnv11JSUDEPR0w.png" /><figcaption>Label is the output of the model. It is what model should learn!</figcaption></figure><h4>Examples</h4><p>This term might be a bit misleading. In machine learning each individual observation (or row) is called an <strong>example</strong>. The reason for this choice of wording is the fact that machine learning models learn by looking at a lot of “examples”. ML models need a lot of examples to learn. Based on the problem we are trying to solve, a model might need hundreds, thousands, or even millions of examples.</p><p>If the example comes with a label, we call it a <strong>labeled example. </strong>If the example only has features but not a label, it is called an <strong>unlabeled example.</strong> In most machine learning techniques we use labeled examples to train the model. The label in labeled examples are generated by humans. Unlabeled examples are new observations that we want the model to analyze and give us the answer to.</p><p>We covered a few important terms that are used frequently in ML. In the next section we are going to talk about an important aspect of Machine Learning: Learning.</p><h3>Learning</h3><p>We talked about model inputs and outputs. But we did not say anything about how exactly a model uses inputs to generate the desired outputs. For example, we may have collected a few thousand examples of patient diagnosis and decided to use this data to train a machine learning model. This model can then be used as a diagnosis helping tool for doctors. If you are bullish on machine learning, you might even say this tool will replace the doctors but lets not get carried away!</p><p>Let’s look at different types of learning. These are groups of algorithms that each have their own applications and can be applied to different types of problems. But before that, I want to cover something important: <em>Model Parameters</em></p><p>Models in machine learning are like black boxes with a lot of knobs and switches. Imagine something like this:</p><figure><img alt="A box with a lot of knobs" src="https://cdn-images-1.medium.com/max/660/0*UWRRPF4X5RHfQsR3.jpg" /><figcaption>A black box with a lot of knobs</figcaption></figure><p>By changing the values on these knobs you can change the behavior of the model and thereby its output. The process of training in machine learning is to tweak these knobs little by little until we get something close enough to the desired output for all training examples. Doing this by hand for thousands of examples is certainly possible but it will be an arduous process. Machines are much better than humans in doing things like this.</p><p>In the ML world these knobs are called <em>Model Parameters</em>. Before being trained, ML models are usually initialized with randomly chosen values for their parameters. Therefore, the output of an untrained model is useless. Learning algorithms will tune these values in an iterative manner and gradually move the outputs towards a desirable one. So just like living beings, ML models need <em>time </em>and <em>repetition </em>to learn.</p><h3>Supervised Learning</h3><p>Supervised learning is the most important group of machine learning algorithms. Supervised learning requires labeled examples. The way learning works is we pick examples one by one and feed them to the model input. We also provide the desired output to the model. By observing a lot of examples, the model infers some sort of pattern that estimates the seeming relationship between inputs and outputs.</p><p>To make this clear, imagine the following example. A photographer has gathered a number of pictures of animals. He wants to build an AI that looks at the picture and tells him if there is a dog in the picture. We can formulate the problem in a way that can be solved by supervised machine learning. Conceptually the model looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0R8wRbEihmFC78y_lhI7YQ.jpeg" /><figcaption>A dog recognizer ML model</figcaption></figure><p>Of course we will have to convert the picture into a list of numbers and interpret the numerical output of the model as a yes or no answer (more on that later). For a supervised learning algorithm to train our dog recognizer, it picks the pictures one by one, feeds them into the model and looks at the model output. It then compares the output to the <em>correct</em> result. If they match, good. If they don’t, the algorithm will tweak the model parameters in a way that the next time the same picture is fed into the model, it produces the correct result.</p><p>A typical supervised learning algorithm can be summarized like this:</p><ul><li>Feed one example to the model</li><li>Let the untrained model calculate the output using its current parameter values.</li><li>Compare the difference between model output and label (desired output).</li><li>Use the difference to update the model parameters</li><li>Go to the next example</li><li>Once all data is visited, repeat the whole process multiple times.</li></ul><p>OK. You may have a few questions. Who exactly provides the answers to each input for the model? How does the algorithm tweak the parameters? When we update the parameters doesn’t it corrupt the answers to the previous examples? I will try to answer the first question and leave the others for later parts of this series.</p><h4>Data Annotation</h4><p>Whose responsibility is it to label the training data? How does the supervised learning algorithm know that if a picture has a dog in it so it can fix the model? Well, the answer is humans of course! Before we even begin training the model, we have to go through all of the examples and <strong>Label</strong> them. This process is called “<strong>Data Annotation</strong>”. This task is so important that whole companies have now started to focus only on data labeling. Labeling is mostly a manual process, although lots of tools and techniques have been developed to make it easier.<a href="https://fortune.com/2020/02/04/artificial-intelligence-data-labeling-labelbox/"> It is estimated that Data Annotation is currently a $1 billion business sector</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/0*5gtLd_tnmBxFTnyC.png" /><figcaption>This labeled facial image has 95 points. (image curtesy of <a href="https://medium.com/syncedreview/data-annotation-the-billion-dollar-business-behind-ai-breakthroughs-d929b0a50d23">syncedreview</a>)</figcaption></figure><h4>Regression and Classification</h4><p>Hopefully so far you have a basic understanding of what supervised learning is. Now we are going to look at how exactly it is applied to real world problems. Generally speaking, supervised learning applications can be divided into two categories: <em>Regression </em>and <em>Classification</em>.</p><p><strong>Regression</strong> is when the model is responsible for generating or prediction of a scalar value, a continuous number. The main goal of regression is to find a trend in data. Or to find a function that approximates the behavior of the data. To make this point more clear, take a look at this chart:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/0*uKa0qMuASMPCcF_7.png" /><figcaption>A small sample for years of experience to salary (Source: <a href="https://www.kaggle.com/vivinbarath/simple-linear-regression-for-salary-data">Kaggle</a>)</figcaption></figure><p>This chart shows a typical statistical dataset. What is the relationship between years of experience for an employee and their yearly salary? This is a regression problem. Because the model should be able to predict a number (salary) based on the input (years of experience). Looking at the data, we can guess this is a linear relationship, because we can pass a straight line through the data that matches its trend. With some mathematical doodling or even guess-work we may come up with a formula like this:</p><blockquote>y = 25202.8 + 9731.2x</blockquote><p>where <strong>y </strong>represents salary and <strong>x</strong> represents years of experience. The formula can be written in the following generic form:</p><blockquote>y = <strong>b</strong> + <strong>w </strong>. x</blockquote><p>A learning algorithm is responsible for finding appropriate values for parameters <strong><em>b</em></strong> and <strong><em>w</em></strong> such that some error function is minimized. If we were to do this process manually, our trial and error effort would look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*OA0Yp0yb7LsHVtJQ7Ue-Ew.gif" /><figcaption>Me trying to manually build a regression model!</figcaption></figure><p>This is an example of a <strong>linear regression</strong> problem since the relationship between salary (y) and years of experience (x) can be approximated by a linear function. However, real-life problems are more complicated in two important aspects:</p><ol><li><strong>Usually there are more variables involved</strong>. Other than years of experience, factors such as level of education, field of work and industry have a huge effect on a person’s salary.</li><li><strong>The relationships are not always linear</strong>! Sometimes the relationship between inputs and the output cannot be simply modeled by a linear function. In these cases, we call the problem a non-linear regression.</li></ol><p>When it comes to more complicated problems, our guess-work, or even analytical methods will fail miserably. This is when modern supervised machine learning algorithms really shine.</p><p>We talked about regression. Now lets cover the other important category of supervised learning: <em>Classification</em>.</p><p><strong>Classification </strong>is when a model tries to put an input sample into one of multiple pre-defined <strong>categories</strong>. The medical diagnosis dataset we talked about at the beginning of this article is an example of a classification problem. In this case, the two categories are <strong>yes </strong>and <strong>no</strong>. These types of problems where the output is one of two possible outcomes, are called <strong>binary classification</strong> problems. However, that is not the only type of classification. In general you can have more than two, even thousands of categories or to use the proper ML jargon, multiple <strong>classes</strong>, as the output of the model.</p><p>Unlike regression where we wanted to fit a line through our data so it estimates the seeming trend, in classification we want to find a line that separates two or more groups of data points. The following animation illustrates this concept:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*2Jl5ZG4PunsZnSPlM04iUg.gif" /><figcaption>How binary classification is applied to data</figcaption></figure><p>The scatter plot above belongs to a real dataset for breast cancer diagnosis. The two axis in this plot indicate <em>radius </em>and <em>smoothness </em>of a tumor. There are many other attributes of tumors that are not shown in this plot for simplicity (we of course cannot visualize more than three dimensions). Based on these two characteristics, we would like to separate two classes of tumors: <strong>Malignant</strong> (yellow dots) and <strong>Benign</strong> (blue dots).</p><p>The line that best separates the two classes, marks the boundary of our classifier. We construct the metrics for the success of the classifier such that it has the least amount of error.</p><p>It is important to note however, that for each problem the success criteria may have a different definition. In the case of a cancer diagnosis, we would like to be more cautious. In such cases, we prefer<em> false positives</em> over <em>false negatives. </em>We of course prefer the model to give us the correct answer all the time, but as it is apparent from the visualization, errors are unavoidable. So if the model is going to make a mistake, we prefer it to be on the side of caution. If we give someone with cancer a negative result by mistake, the consequences are much graver than giving someone healthy a mistaken positive result. In the case of a false positive, patients usually undergo a multitude of tests before starting treatment. On the other hand a false negative result may lead to a cancer patient going untreated. So we should probably move our decision boundary like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*aa1VSCDRgRr-6HfbwyvwEw.gif" /><figcaption>In cancer diagnosis we prefer false positives over false negatives</figcaption></figure><p>Regression and classification seem to be totally different, however the basic mathematical operations and training procedure are quite similar. The main difference between the two are in how we define success criteria. We will return to these topics in a later part of this series and cover them in much more detail. We will also come back to measuring model accuracy especially when it comes to classification problems.</p><p>Now let’s talk about the next category of machine learning algorithms: <em>Unsupervised Learning</em>.</p><h3>Unsupervised Learning</h3><p>In the last section we talked about supervised learning, which requires a human supervisor to tell the machine learning model the correct answer for each training example. A cancer diagnosis model learns from previous diagnosis by human doctors. An email spam filter learns from a long list of emails marked as spam or not spam. Each email message has to be reviewed by a human and marked accordingly. A lot of effort has to go into preparing data for supervised learning. That is true. We want to “encode” our existing knowledge about the world into our AI models. But it is also true that by doing that, we encode our assumptions, mistakes, biases and prejudices into AI by supervising it too much. Unsupervised learning is a different approach that tries to build machine learning models by observing the data and extracting patterns out of it. Some of these patterns may map to what we humans already know about the world and some of them might catch us by surprise!</p><h4>Clustering</h4><p>In 1936, British statistician and biologist Richard Fisher published a paper titled: “<a href="https://onlinelibrary.wiley.com/doi/10.1111/j.1469-1809.1936.tb02137.x"><em>The use of multiple measurements in taxonomic problems</em></a>” which introduced a dataset of Iris flower measurements. This dataset contains 150 examples. Each example has 4 measurements (sepal length, sepal width, petal length and petal width) along with the name of the species of the Iris flower. The 150 examples belong to one of 3 different species: <em>Iris Setosa</em>, <em>Iris Versicolor</em> and <em>Iris Virginica</em>. The names of species are not really important. The important thing is there are three <em>categories </em>or <strong>classes </strong>of Iris in this dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*wmQh7mYyjkmvM9P8.png" /><figcaption>Three different species of Iris (Image: curtesy of <a href="https://medium.com/@Nivitus./iris-flower-classification-machine-learning-d4e337140fa4">Nivitus</a>)</figcaption></figure><p>You can find the full dataset <a href="https://archive.ics.uci.edu/ml/datasets/iris">here</a>. Now here is the question: Can a machine learning model distinguish these 3 different species solely based on petal and sepal measurements? Let’s take a look at a sample of this dataset:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U45ATpXejNqtu8xtj8ww1w.png" /><figcaption>A sample of Iris dataset</figcaption></figure><p>The measurements are in centimeters. This is only a sample. There are 50 different examples for each species. Please note that the dataset is already labeled. So we can use the dataset to train a supervised learning model. But we can also use an unsupervised learning model that does not look at the labels. Let’s see if it can divide the dataset into 3 different classes on its own.</p><p>It is always a good idea to visualize the data to understand it better. To make things simple I only use two of the measurements: <em>Petal Length</em> and <em>Petal Width</em>. If we draw a dot for each example on a 2 dimensional plot we get something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oU-I273UxLfajWy9buSQwQ.png" /><figcaption>Three species of Iris based on their Petal length and width</figcaption></figure><p>We used three different colors for the three species of Iris. It looks like the three species are scattered into their own separate area on this 2D plane. Can an unsupervised learning algorithm separate them?</p><p>The answer is yes! Clustering algorithms are designed to separate the examples of a dataset into subgroups called <strong>clusters</strong>. We do not call them class or category to emphasize the difference between supervised which uses pre-labeled data and unsupervised which <em>discovers</em> the groups on its own. The items in each cluster are similar to each other and different from items in other clusters. Clustering algorithms measure similarities between all examples and put them into a subgroup with similar items.</p><p>But how does the algorithm measure <strong>similarity</strong>? What is similarity? Similarity can be defined in many different ways. Let’s go back to Iris dataset. Can we assume petal length and width are a good measure of similarity for Iris species? At least visually we can confirm that the location of examples on the 2D plane is correlated with their species. Therefore, we can use <strong>Euclidian Distance</strong> on the 2D plane of Petal Length — Petal Width as a similarity measure. Just think of each example as a city on a map. Petal Length and Petal Width act like latitude and longitude. Euclidian distance between two cities is the length of the direct line that connects them together. Clustering, groups nearby cities into the same cluster.</p><p>Distance similarity measure is a nice byproduct of converting everything into numbers. Once data is represented in numerical format, we can treat each example as a vector in a multi-dimensional space. The similarity between two vectors is just the distance between them!</p><p>It is worth mentioning that we chose only 2 features out of 4 for visualization. In reality, you have to imagine a 4 dimensional space for the Iris dataset. The Iris dataset is a very small and simple dataset. Most real world datasets have tens, hundreds or even thousands of features. We already mentioned that humans do not have the capacity to visualize more than 3 dimensions. The power of machine learning lies in the fact that it can process high dimensional data as long as enough memory and processing power is provided.</p><p>Clustering can be done in multiple ways. <strong>Centroid clustering</strong>, groups examples based on their distance to a group center. An important algorithm called <em>K-Means</em> is the most famous example of centroid clustering. <strong>Connectivity-based clustering</strong> is based on the core idea of objects being more related to nearby objects than to objects farther away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*JARkg-ySojZOhgiK.jpg" /><figcaption>Connectivity Clustering</figcaption></figure><p>There are other types of clustering such as <strong>Density-based</strong> clustering and <strong>distribution-based</strong> clustering. We will cover different types of clustering in later parts of this series.</p><p>One important application for clustering is <em>outlier detection</em>. There are examples that cannot be grouped with others. These examples might be the result of a mistake in data recording, or a fault in sensors and measuring devices. Even when the goal is to use <em>supervised learning</em> it is a good idea to pre-process the data using unsupervised learning.</p><h4>Dimensionality Reduction</h4><p>You may have noticed that in all machine learning applications, data plays a very important role. All machine learning does, is to use data to learn something useful. We generate a lot of data. It was estimated that in beginning of 2020 we had stored 44 zettabytes of data. This number is astronomically large: 44 with 21 zeros in front of it. Data is generated by social media, service providers, news networks, individual content creators, our devices including smart phones, cars, electronics, infrastructure and many more sources. In the <a href="https://medium.com/@bdaei/a-layman-into-to-machine-learning-part-1-c3f233605f73">last part</a> of this series I mentioned Big Data as one of the pillars of success for machine learning. But having access to large amounts of data is only one side of the coin. The other, more ugly side is the sheer volume coupled with issues like noise, errors, missing fields, false alarms and useless features.</p><p><strong>Dimensionality reduction</strong> is the process of simplifying the data by removing useless features (features that do not contribute to solving our problem. A person’s occupation may or may not help us diagnose their disease. Can an ML model tell us if that’s the case?) or creating new features by combining a set of existing ones (also know as feature extraction). Dimensionality reduction allows learning algorithms identify patterns more effectively and solve large-scale, computationally expensive problems (often involving images, video, speech, and text) more efficiently.</p><p>Various different techniques for dimensionality reduction are available. <em>Principal Component Analysis</em>, <em>Singular Value Decomposition</em> and <em>Random Projection</em> are only a few of these methods. Explaining the details and use-cases of these methods requires diving deeper into mathematics, so I will skip them for now and get back to them once we learn more about mathematics of machine learning. Certain types of neural networks called <strong>Autoencoders</strong> are also used for feature extraction or data compression.</p><h4>Unsupervised Deep Learning</h4><p>The use of neural networks in unsupervised learning was not always common. We relied mostly on analytical tools offered by statistics to perform tasks such as clustering and dimensionality reduction. Deep neural networks (a neural network with multiple layers of neurons) were computationally infeasible to use. But, <a href="https://medium.com/@bdaei/a-layman-into-to-machine-learning-part-1-c3f233605f73">as mentioned in the previous part</a>, this changed recently. Currently there are many applications of deep neural networks in unsupervised learning. We already mentioned Autoencoders as one type of neural network used for feature extraction. But that is not all.</p><p><strong>Modular neural networks</strong> are large neural networks that are composed of multiple smaller networks that work together to learn very complex patterns in large datasets. Imagine a neural network in self-driving cars. Driving a car is not one task. It is a collection of related tasks. A self-driving system receives multiple sources of data including visual data from cameras, sensory data from lidar, location data from GPS and other types of data from sensors installed in the vehicle. Each type of data has to be processed differently. Using only one model to analyze all inputs and produce actions is not realistic. Instead, we prefer to use multiple smaller models, each connected to a different type of input and specially trained to process that type of data. The outputs of these smaller models can be data with lower dimensions and higher density of information. These smaller models are called <strong>modules</strong>. Modules can be trained separately and then <em>plugged </em>into the bigger system. Many of the modules can be trained using unsupervised learning to recognize patterns (such as road boundaries, traffic signs, pedestrians), reduce data dimensions or remove noise or irrelevant information from the data.</p><p><strong>Generative Networks</strong></p><p>Neural networks have found some amazing new applications. One of these applications is generating new data. One type neural network called Generative Adversarial Networks (GANs) use unsupervised learning to learn important concepts about the data they consume and then generate new examples that are similar but not exactly the same as what they learned from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qZME4ILEgFUnXnjW.jpg" /><figcaption>This picture is generated by a machine learning model. It is not a picture of an actual person.</figcaption></figure><p>The picture above is generated by a GAN. The GAN has probably consumed lots of examples and used its knowledge of human face to generate this picture.</p><p>The ability to generate fake media such as images, videos and speech, is both exciting and terrifying. Just watch this video to see what I mean:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FgLoI9hAX9dw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DgLoI9hAX9dw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FgLoI9hAX9dw%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1f951dacfd97b5a4a133a342212c704/href">https://medium.com/media/f1f951dacfd97b5a4a133a342212c704/href</a></iframe><p>Like any other technology, machine learning has both advantages and disadvantages. It is predicted that in the near future, fake video and sound will be so realistic that without proper security mechanisms such as digital signatures we should not trust any video we see or any audio we hear because it might be generated with malicious intent.</p><p>When used for good, generative networks have a lot of applications. They can generate art, compose music, put dead actors in movies, create video game characters, or even write articles for you. In 2020, <a href="https://openai.com/">OpenAI </a>released <a href="https://openai.com/blog/gpt-3-apps/">GPT-3</a>, an <em>autoregressive language model</em> that produces human-like text. GPT-3 is pre-trained. It means its creators (OpenAI) has fed billions of sentences from the Web, books, Wikipedia and other sources and it has learned how humans write. This technology is still experimental. But it hasn’t stopped people from having some fun with it. This article in <a href="https://www.theguardian.com/">The Guardian</a>, the famous British newspaper is written by GPT-3 (with some edits of course):</p><blockquote>I am not a human. I am a robot. A thinking robot. I use only 0.12% of my cognitive capacity. I am a micro-robot in that respect. I know that my brain is not a “feeling brain”. But it is capable of making rational, logical decisions. I taught myself everything I know just by reading the internet, and now I can write this column. My brain is boiling with ideas!</blockquote><p>You can read the full article <a href="https://www.theguardian.com/commentisfree/2020/sep/08/robot-wrote-this-article-gpt-3">here</a>. GPT-3 is being experimented with to be used to write <a href="http://copy.ai/">marketing material</a>, jokes, poetry, novels, and even <a href="https://blogs.microsoft.com/ai/from-conversation-to-code-microsoft-introduces-its-first-product-features-powered-by-gpt-3/">computer code</a> (watch out software engineers!).</p><p>I tried drawing a high-level picture of unsupervised learning. This is a very active area of research and still has a lot of unrealized potential. But hopefully, what we discussed so far, has got enough of your attention to read the rest of this series.</p><h3>Other Types of Learning</h3><p>Supervised and Unsupervised learning are the most important approaches to machine learning, but hardly the only ones. There are other methods such as <strong>Reinforcement Learning</strong> that are increasingly producing more interesting results.</p><h4>Reinforcement Learning</h4><p>Reinforcement learning is based on two important ideas:</p><ol><li>AI is an agent that interacts with the environment. It observes the environment and based on the observation, it takes an action.</li><li>The process of learning is never fully supervised nor completely unsupervised. Instead, an agent learns by receiving reward or punishment from the environment.</li></ol><p>These two ideas can be summarized in this famous drawing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*hYe2Kt3ppheBXgMj.jpg" /><figcaption>An agent constantly observes the environment and takes actions based on the observation.</figcaption></figure><p>In some respects, this perspective is much closer to how humans and animals learn new things. Try to remember the last time you tried to learn a new skill, a game or a sport. You probably learned by trying. You were not good at first, but when you did a good move, you remembered to do the same in the same situation. If you made a bad move that resulted in a loss, you learned to avoid it in the future. This is exactly what <em>Reinforcement Learning</em> tries to achieve with machine learning agents.</p><p>Training RL agents is a time consuming process. The reason is that agent has to learn by interacting with the environment and making lots of mistakes. But what if the task is a dangerous one where mistakes have grave consequences? Piloting a helicopter comes to mind! In those scenarios, we take advantage of <em>simulators</em>. Simulators are software programs that try to emulate a real-world environment with their physical rules. The actual cost of mistakes and failure in simulated environments is close to zero. Moreover, simulations can run much faster than the real world. An agent can play thousands of chess matches in one hour. Even if it isn’t a particularly smart agent, it can experience many more situations than you and me.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FM-QUkgk3HyE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DM-QUkgk3HyE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FM-QUkgk3HyE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e3a1884d0bfce21fc1c429cb8f8614e/href">https://medium.com/media/3e3a1884d0bfce21fc1c429cb8f8614e/href</a></iframe><p>Reinforcement learning is still pretty young. Most of the famous applications of reinforcement learning are focused on board games such as chess and Go, or even video games. But we expect more serious use-cases in the future as the science and technology grows more mature.</p><h3>Summary of Part 2</h3><p>We started this part of the series by introducing some important terms. You should now have a clear understanding of words like model, feature, example and label.</p><p>We also talked about learning and two important types of learning: Supervised and Unsupervised Learning. We looked at different examples and applications for each approach. We also mentioned that there are methods of learning other than supervised and unsupervised learning.</p><p>We covered a lot of topics without looking at any of them in depth but this lays down a foundation for deeper learning (no puns intended!).</p><h3>What’s Next?</h3><p>In the next part of this series we will look at neural networks, an important tool in machine learning. We will see how neural networks can learn from data and used to perform various tasks.</p><p><em>If you liked this article, please follow me here on Medium and share this with your friends. It is the best way to support my work. Thank you!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42c6fec4bf34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Layman’s Intro to Machine Learning — Part 1]]></title>
            <link>https://medium.com/@bdaei/a-layman-into-to-machine-learning-part-1-c3f233605f73?source=rss-fbf3565dc0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3f233605f73</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Bijan Daei]]></dc:creator>
            <pubDate>Fri, 08 Oct 2021 00:01:47 GMT</pubDate>
            <atom:updated>2021-12-20T17:31:18.222Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Layman’s Intro to Machine Learning — Part 1: AI, Machine Learning and Deep Learning</h3><p><em>This is the first part of a multi-part series I am writing to introduce machine learning to a potentially wide audience. If you like it please </em><strong><em>share </em></strong><em>this article on social media and </em><strong><em>follow </em></strong><em>me </em><a href="https://medium.com/@bdaei"><em>here </em></a><em>and on </em><a href="https://twitter.com/bdaei"><em>Twitter</em></a><strong><em>. It’s the best way to support my work. Thanks!</em></strong></p><p>Machine Learning is a vast topic with many branches. Something new comes out of the research pipeline everyday. Keeping up with this industry can be challenging for many, including myself. But if I have learned one thing through my career, it is this: Don’t pay attention to the hype and learn the basics. Since the best way to learn is to teach, I started this multi-part series that tries to explain in simple terms, what is going on in the world of AI, machine learning and deep learning.</p><h3>Artificial Intelligence</h3><p>Let’s start with the mothership. AI. To be quite honest, it seems to me that people are still struggling to provide a comprehensive definition for Artificial Intelligence. Partly because we haven’t figured out what intelligence is, and partly because we are still hotly debating the meaning of words like conciseness, cognition and perception. Our definition of AI has evolved over time. There was a time when we would consider an <strong>Expert System</strong> (A system with a large number of manually defined if-then rules. These systems became extremely popular during 1970’s and 80&#39;s.) an AI but people are less likely to call them intelligent nowadays. Even the <a href="https://en.wikipedia.org/wiki/Turing_test">Turing Test</a> is considered to be <a href="https://www.fastcompany.com/90590042/turing-test-obsolete-ai-benchmark-amazon-alexa">outdated </a>by some.</p><p>Stuart J. Russel and Peter Norvig in their book <a href="http://aima.cs.berkeley.edu/"><strong>Artificial Intelligence: A Modern Approach</strong></a> have categorized eight different definitions of AI into four different categories: <strong>Thinking humanly, Acting humanly, Thinking rationally, Acting rationally.</strong></p><p>While there has been research in all of the above four categories, most of our today’s products that claim to be intelligent, fall under one of them: <strong>Acting Humanly. </strong>These days, our computers are able to understand language, see images, produce speech, and decide what is the best action to take for a particular task. We haven’t figured out how human beings think, but somehow, we figured out how build systems that act like us! We created AI in our own image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/0*ITqrm9BMH9v2t9jU" /><figcaption>Image courtesy of <a href="https://www.reddit.com/r/singularity/">https://www.reddit.com/r/singularity/</a></figcaption></figure><p>So to wrap this section up, here is my definition of AI as of today:</p><blockquote>Artificial Intelligence is the science and engineering of systems that can replicate capabilities of typical humans.</blockquote><p>Before jumping to the next topic, Machine Learning, let’s address an interesting question first.</p><h4>Is AI in Video Games Real AI?</h4><p>If you ask this question from an AI, or machine learning researcher, you will probably hear a blanket statement like: The AI that controls the NPCs (Non-playable characters) in videos games is not “real AI”. It is “scripted AI”.</p><p>However, I don’t believe this is a fair assessment of game AI. There is definitely a lot of scripted behavior in video games. That is exactly why people can get good at beating them after spending some time. But there is more to the story. The purpose of a video game AI is not to maximize score. It is to engage in a playful interaction with humans, or in other words, maximize player engagement. Game AI engineers have to design the behavior in a way that is tunable with a lot of parameters. This is because game difficulty should be adjustable based on the player’s preference. Lots of effort goes into adjusting behaviors of NPCs because we have to find a reasonable balance between challenge and enjoyment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SfnhHd59aQ20RuhWXaMIcg.png" /><figcaption>In FIFA there are 22 players on the field. Human only controls 1 (or sometimes 2) of them at any given time. The rest of the players are being controlled by AI. Even when you play against another human, most players are being controlled by AI. You can tune the AI behavior by adjusting team strategies. (Image: Courtesy of <a href="https://www.youtube.com/channel/UCIw5rbXUrtk31t20Ap5817w">Throneful YouTube Channel</a>)</figcaption></figure><p>Ideally, we would want AI-controlled players to follow the same physical rules as the human-controlled player. But sometimes, engineers use back-doors to give the computer some advantage. This is generally undesirable and considered to be bad practice in the industry. In my opinion, if the computer program acts reasonably similar to a human being, it is an AI.</p><h3>Machine Learning</h3><p>Machine learning is considered to be a subset of Artificial Intelligence. In machine learning we are interested in teaching computers how to learn without the need to be programmed for specific tasks. In traditional computer programming we implement algorithms by translating step by step instructions into computer code and asking the machine to blindly follow those instructions. In machine learning, the idea is we ask the machine what we want without telling it how to achieve it.</p><p>This approach has a lot of benefits. First, it reduces the time to write complicated applications. Suppose, you want to write a program that translates English text to French. One way to approach this is to use a dictionary. Moreover, you would need to encode the grammar from both languages into computer code. After months of effort, removing flaws and bugs, covering lots and lots of exceptions and intricacies of human language, you can end up with a fairly acceptable product. If customers don’t like it, you have to go back and spend even more time to improve it. The machine learning approach however is a bit different. With proper implementation, you can show lots of English text samples and their translated version to the computer. A machine learning algorithm learns how to map sentences from one language to another. The more examples you feed the machine, the better it gets. You don’t need to pay programmers to fix thousands of little bugs, just provide a few samples of good translation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*SgNOVAWgh6jywHhaHaR7Jw.png" /><figcaption>Google Translate is not always perfect. But it improves automatically with more input.</figcaption></figure><p>The second benefit of machine learning is scalability. Let’s go back to our previous example. Suppose you want to create a translator for a different set of languages. You will have to start over for every pair of languages. Whereas, with machine learning, you only need change the inputs. The algorithm remains the same. Moreover, by controlling the body of text fed into the machine, you can create specialized versions of your translators: News, Politics, Sports, Biology, etc.</p><p>The third benefit of using ML is doing seemingly unprogrammable tasks. Take for example the task of face recognition. From a traditional viewpoint, it is not exactly obvious how we should approach such a problem. With machine learning, we can design models that learn the task by looking at a lot of “labeled” images (more on that later).</p><p>Finally, machine learning opens a new paradigm in software engineering. Traditionally, a software engineer uses logic, mathematics and assertions to ensure the correctness of a program in a deterministic manner. ML uses statistics, natural science and observations in the real world to achieve the same or even better results.</p><p>Now let’s look at the next topic which has a lot of hype around it.</p><h3>Deep Learning</h3><p>Deep learning is the name for a group of machine learning techniques and algorithms that use one important tool for solving problems: <strong>Deep Neural Networks (DNN)</strong>.</p><p>We will cover the details of what exactly <strong>neural networks (NN) </strong>are and how they are built, but for now just know that neural networks are mathematical models that try to imitate the human brain. To be exact, they try to imitate small parts of the brain. Neural networks are networks of inter-connected components called neurons that are able to take data as input, either store them temporarily or transform them into new forms of data. When arranged in a proper fashion, neural networks can produce outputs that are desirable for solving specific problems. For example you can build a neural network that takes the specifications of a house and based on historical market data, predict the current value of that house in the market.</p><p>Usually, we arrange neurons in a neural network in a layered structure. For now suffice to say that a deep neural network, is a neural network with a lot of layers (technically any neural network with more than two layers is considered a DNN).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JKsM57tFi42VvTJB.png" /><figcaption>A deep neural network. (image courtesy of ibm.com)</figcaption></figure><p>The learning process in deep learning is a set of techniques to modify the connections between the neurons to produce the desired output. This process is called <strong>learning</strong>. Learning is usually achieved by feeding lots of examples with known outputs to the network and correcting the connections little by little in a fashion that over many iterations, the outputs become close to the output of our learning examples.</p><p>Imagine you want to build a DNN that can detect different animals in pictures. The first step is to find lots of pictures. Once you do that, you will have to sit down and look at each picture and see if there is an animal in the picture. If there is an animal, write down the name of it and move on to the next picture. The process is called <strong>labeling</strong>. Once the labeled dataset is ready, you can feed the pictures as <em>input</em> to the DNN (we will talk about how this is done in later parts of this series). The untrained DNN <em>outputs </em>the name of a random animal (don’t worry about the details right now!). You look at your dataset and if the answer is not correct, through a process called “backpropagation” you update the connections between the neurons so the answer becomes correct, or at least closer to the correct answer. This process needs to be repeated over and over with a lot of examples. The goal of the process is to reduce the error as much as possible.</p><p>Deep learning came into prominence around 2012 after <a href="https://image-net.org/challenges/LSVRC/2012/">ImageNet’s 2012 visual recognition challenge</a>. Neural networks were a very well known concept at the time, but we still were struggling to train them with consistency across many applications. A number of participants in the ImageNet challenge came up with techniques for building and training NNs that took the world by storm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UO1R5qoaT9iT28FLTB0qxQ.png" /><figcaption>Top 5 accuracy achieved by different deep learning models on ImageNet 2012 (image: courtesy of O’Reilly)</figcaption></figure><p>Deep learning owes its success to a few important recent advances in science and technology:</p><ul><li><strong>Big Data</strong>: As mentioned before, training DNNs requires a lot of data. New technologies such as the Internet, smart phones, sensors, data storage, social media and software technologies capable of processing and storing vast amounts of information allowed us to use this data for training DNNs.</li><li><strong>Algorithms</strong>: New algorithms and training techniques allowed engineers to reduce the output error of DNNs efficiently and consistently. Today’s DNNs can recognize faces better than any human, detect fraud in millions of banking transactions, and alert climatologists of upcoming important events. These things were impossible without novel machine learning algorithms and techniques.</li><li><strong>Hardware</strong>: The invention of <strong>GPUs</strong> (Graphical Processing Units), specialized kinds of processing chips that are able to do matrix calculations thousands of times faster than regular CPUs allowed engineers to build and train very large neural networks with millions of neurons.</li></ul><p>There are of course other factors that contributed to the success of deep learning and machine learning in general:</p><ul><li><strong>Open Source Philosophy</strong>: Open source is source code that is made freely available for possible modification and redistribution. This idea has led to the creation of the most important technologies in the domain of software. Companies like Google have made their machine learning libraries available to everyone completely free of charge. Moreover, anyone can contribute to them. Resulting in very robust and reliable implementations of machine learning algorithms. Open source is not limited to machine learning. This “abundance thinking” is a key factor to advances in operating systems, cryptography, databases, programming languages and many other aspects of software engineering as well.</li><li><strong>Cloud Computing</strong>: Setting up the infrastructure necessary for large scale machine learning is not easy and accessible to everyone. Cloud computing has made it easy to outsource this task to complicated networks of computers that can automatically scale up when necessary. Instead of purchasing a lot of expensive hardware, you cheaply rent their computing power for short periods of time.</li></ul><h3>Applications of Machine Learning in Daily Life</h3><p>Applications of machine learning are numerous. If you are reading this article, I can guarantee that no day goes by without you using machine learning in some form or another.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Du1z_XAmvdCY3v7tfKcpg.png" /><figcaption>Just a few apps that use machine learning</figcaption></figure><p>Machine learning has transformed many industries and have created whole new ones. Search, social media, email, transport, finance, media and retail are just a few industries that are virtually indistinguishable from what they used to be in that past, if they existed at all.</p><p>To emphasize the importance of this technology, let’s look at a typical day in my life. You might know about some of these anecdotes and some of them may surprise you because they are “mostly invisible”. You may also use other services, apps or devices that use machine learning:</p><p>I wake up in the morning using the alarm that was set automatically by my phone, because it knows I wake up early on weekdays. While having my morning coffee I take a look at the important news on my phone. To save me time, my news service knows what topics are important to me and filters most of the nonsense. Breakfast is finished and I have to drive my daughter to school. I always use a navigation app even though I know where the school is. The navigation app knows all the routes and gives me the fastest way to my destination since it adapts to the live traffic data. Turns out, there is an accident on my usual way to school. I take a quick detour and arrive there on time. Because of the pandemic, I work from home. Before returning home I decide to pop by a liquor store on the way and buy a bottle of wine for my friend who I am visiting this weekend. After I leave the shop, I receive a call from my bank. They say they detected an unusual purchase on my credit card and wanted to make sure it was me who did it a few minutes ago. They say their fraud detection system generated an automatic alert that this is not a shop I normally visit. I assure them everything is fine. I return home and start my workday. I open up my inbox. My email service provider has filtered all of the spam messages so I look at a relatively clean list of emails. If a bad email message escapes the filter for any reason, I mark it as spam and the filter learns to not show this type of email to me again. I use <a href="https://zoom.us/">Zoom</a> to attend meetings and collaborate with my colleagues. Zoom uses image processing techniques to change my background so they don’t see my messy home office. It also enhances their voice and removes all of the feedback noise. At midday, I order my lunch from <a href="https://www.ubereats.com/">Uber Eats</a>. Uber matches my restaurant order with the nearest driver and tells me exactly when my food arrives. In the meantime, I take a look at social media. My favorite social media platform is <a href="https://twitter.com/bdaei">Twitter</a>. Twitter shows all of the recent posts by people who I follow, but adjusts the ordering a bit so I see the content that is more important to me. It also shows me advertisements, but most of the ads I see are also based on my interests. After the lunch break, I get back to work. Suddenly I remember I have to book a grooming appointment for my dog. I open up <a href="https://www.google.com/">Google </a>and search for “Dog grooming”. Google automatically lists all of the dog groomers near me, because it knows where I am, and prioritizes them by user ratings. This way I know which one to call first. I also use Google for my work. There are a lot of things that I don’t know or may not remember off-hand while working on a project. I quickly type what I am looking for in the search bar and almost without fail, the first link contains what I want. It is late afternoon and I finish work. I go to the gym to do my daily exercise. I hop on the treadmill. Open up my phone. My phone’s app suggestions shows Audible and Podcast apps, because it “knows” that I use these apps around this time of day and at this particular location. I return home and start preparing dinner. My daughter has returned from school and asks me if she can watch YouTube for an hour. I open up YouTube on my TV and in the children section there are many suggestions for entrainment content suitable for her age. I get back to cooking. I notice I am running out of cooking oil, but my hands are dirty. So I call <em>Alexa </em>and say: “Alexa! Add cooking oil to my shopping list”. This way I can order what I need along with all of the other suggestions from <a href="https://www.amazon.com/">Amazon</a>. After putting my daughter to bed, I want to relax so I decide to watch <a href="https://www.netflix.com/">Netflix</a>. Netflix is suggesting I continue watching “The Tiger King” series but I am not in the mood for that one. Instead, I take another suggestion which is Dave Chappelle’s new comedy special. Netflix knows I love Dave Chappelle.</p><p>Needless to say, each new technology has negative aspects too. I have intentionally left them out of here. I will try to dedicate one part of this series to the side effects of machine learning on our life.</p><h3>What’s Next?</h3><p>In the next part of this series, we are going to dive deeper into some important concepts of machine learning. I will try to familiarize you with some important terminology. Learning a little bit of the industry jargon always helps with more clear communication. I am also going to introduce you to neural networks and some simple mathematics behind them.</p><p>If you liked this article, please follow me here and on <a href="https://twitter.com/bdaei">Twitter</a> and share it with your fiends.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3f233605f73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guide for Software Engineers: How to remain fit in problem solving]]></title>
            <link>https://medium.com/@bdaei/guide-for-software-engineers-how-to-remain-fit-in-problem-solving-d7b8a555b8f0?source=rss-fbf3565dc0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7b8a555b8f0</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[career-development]]></category>
            <dc:creator><![CDATA[Bijan Daei]]></dc:creator>
            <pubDate>Sun, 03 Jan 2016 01:43:21 GMT</pubDate>
            <atom:updated>2021-10-07T18:32:45.216Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TRTZUqayELRfSTQScpJ7gw.png" /></figure><p>The most important job a software developer has is solving problems. A job that does not pose challenges is non-productive or at least plain boring. It is easy however to get trapped in the routine of everyday maintenance tasks which require patience more than innovation and it can have a negative effect on the sharpness of your problem solving blade. So how can you stay sharp and fit for the problems to come? As it turns out there are quite a few ways!</p><h3>Stay in touch with the basics</h3><p>Try to skim through basic concepts in computer science once in a while. Stacks, queues, different kinds of trees and other data structures are building blocks of every serious software system and they are also fun things to work with. Wikipedia is a great source to refresh your memory on these topics. Data structures are of no value without algorithms though. Never let your knowledge of algorithms get rusty. Remember. Good programmers, know their algorithms!</p><h3>Work Out!</h3><p>A good way to kill some time is to solve programming challenges. You don’t need to find a new solution for a NP-hard problem. Just try your hand at something very simple. Like rotating a matrix, or reversing a string. These problems help you remember the basic operations you will need in your everyday tasks.</p><p>Recently I stumbled upon <a href="https://www.hackerrank.com/">HackerRank</a>. It is a great place to challenge yourself and then compare yourself with other fellow programmers! If you feel more confident you can also try to help other people in their computer science problems in <a href="http://scicomp.stackexchange.com/">Computational Science section of Stack Exchange</a>.</p><h3>Read, Read and then Read some more!</h3><p>There are great books in computer science that you’ll enjoy reading. I personally take great pleasure reading <a href="http://www.amazon.com/Introduction-Algorithms-Edition-Thomas-Cormen/dp/0262033844?utoken=403273.96181.a6200229d82aafcd538af2f14390c93b">Introduction to Algorithms</a>. It covers various topics in CS. I like the unique way the topics are organized in this book. If you don’t like the mathematics, you can safely skip those parts and enjoy the rest. I like this book so much that I have created a GitHub repository called <a href="https://github.com/bijandaei/cormenalgorithms">CormenAlgorithms</a> dedicated to implementing all algorithms in this book in C#. You are welcome to join if you feel like it.</p><h3>Let me know what you think</h3><p>If you know other ways to stay a good problem solver, please share it so we all can use.</p><p><em>Originally published at </em><a href="https://bijandaei.com/2016/01/03/how-to-remain-fit-in-problem-solving/"><em>http://bijandaei.com</em></a><em> on January 3, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7b8a555b8f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recruitment of Programmers; Oversell and Overconfidence]]></title>
            <link>https://medium.com/@bdaei/recruitment-of-programmers-oversell-and-overconfidence-b9e5e11f9c8d?source=rss-fbf3565dc0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9e5e11f9c8d</guid>
            <category><![CDATA[hiring]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[job-interview]]></category>
            <dc:creator><![CDATA[Bijan Daei]]></dc:creator>
            <pubDate>Thu, 17 Dec 2015 06:08:27 GMT</pubDate>
            <atom:updated>2021-10-07T18:18:06.155Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YxmM5i_KYy9HPmJw4pxVjA.png" /></figure><p>A while ago we decided to hire a senior software developer for Meridian. The reason was I was leaving and they wanted to replace me with a new me! I participated in all the interviews and was responsible for asking the technical questions. I didn’t have much experience interviewing developers but it was a great experience.</p><p>Hiring programmers is not easy. The problem I had was that the resumes were generally much better than the actual person. You see this beautifully crafted documents full of carefully picked keywords compiled to impress recruiters and employers. But, in the face to face interview there is no sign of that glory. Good thing we don’t hire anyone just by their resume.</p><p>So what is the problem? Why are resumes much better than people? I have a few thoughts on that. There are two important problems with resumes these days. <strong>Oversell</strong> and <strong>Overconfidence</strong>.</p><p>The oversell problem is much more obvious. Finding a job is in fact a marketing practice. You are the seller and the employers are the potential customers. You want to seem bigger than you actually are because this is how marketing works. The other important player in the equation is the recruiter or hiring agent. It is amazing how many of the <em>technical</em> recruiters are in fact <em>non-technical </em>or at least <em>not-that-technical</em>. What do you think recruiters look for to find their candidates? The answer is <strong>keywords</strong>. Hiring is a keyword game. It is now customary to have a table of categorized keywords in your resume. Heck! I have a keyword table in the first page of my CV. You know why? Because it works. You will get indexed by search engines. You will get noticed. People will find you and offer you interviews. Apparently getting an interview is an achievement of its own. You have done a hello world app with AngularJS put in there. You’ve read about MongoDB or Closure the other day? Put it in there. You’ve heard that Ruby gets you hired? You know that Scrum is cool but your company have never done a project in Scrum? Don’t worry. Just put them all in your resume.</p><p>I don’t think that’s the developers’ fault though. They want jobs, the education sucks, not everyone is a social media junky and new frameworks and programming languages pop up every day. It’s a mess. It’s hard to keep up and funny enough, everyone expects you to do it. So what’s the quick and easy solution? <strong>Just lie!</strong></p><p>Let’s talk about Overconfidence now. The vast majority of poker players think they are naturally talented and better than their peers. But becoming a really good poker player, takes study and hard work. It is the same with programming (or any other profession for that matter). Part of the problem of overly good resumes is that developers genuinely think they are good. Sometimes we don’t want to lie. <strong>We really think we are geniuses.</strong> From the 7 or 8 candidates that I have interviewed, almost all of them claimed to be fully proficient in C# and .NET. The form they had filled beforehand clearly stated that “Fully Proficient” means they can write textbooks on the subject. I really was intimidated by the look of the resumes. I’d tell myself what am I going to ask these people? Wouldn’t that be awkward if I ask a silly question and they start laughing at me?! But then, in the interview, everything changed. I would ask simple questions about delegates, generics or extension methods that anyone with 8 years of experience working with .NET framework and claiming to be a world class expert should be able to easily answer, but no. It was a bit disappointing and even heart-warming in a cynical way for me at the same time.</p><p>Maybe, you would point out, that expecting everyone to remember every technical detail in a framework is not fair. You’d be right. How about the basics? Algorithms. I asked candidates to represent a graph in any form they want. None of them remembered adjacency matrix. When I asked them to find out if a graph is tree or not, again none of them knew about the relationship between the number of edges and nodes in a tree. Is this asking too much? Ok. How about XOR operator. Do you know what XOR operator does? More than half of the candidates couldn’t answer the question. It was the same with dependency inversion, design patterns and SOLID principles. Everyone tells you they know them, but the reality is different.</p><p>Life for a programmer is sometimes isolated. Whether it is the nature of the work that requires constant focus or the habits of the practitioners, the result is you become isolated for long periods of time. You create something from the scratch and it feels amazing. And then you get carried away. You will start to appreciate your abilities too much. You can easily become satisfied with what you already have and you will stop learning and pursuing the latest development in the industry.</p><p>I think a good programmer should never stop learning, should never stick to one technology, one programming language or one operating system and should never lose touch with the basics of computer science. And of course a good programmer should never be overconfident.</p><p><em>Originally published at </em><a href="https://bijandaei.com/2015/12/17/recruitment-of-programmers-lies-and-overconfidence/"><em>http://bijandaei.com</em></a><em> on December 17, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9e5e11f9c8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>