<?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 Camille Dunning on Medium]]></title>
        <description><![CDATA[Stories by Camille Dunning on Medium]]></description>
        <link>https://medium.com/@camilledunning?source=rss-5a8b858c8370------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*S8K2Ii36andD4Y7G</url>
            <title>Stories by Camille Dunning on Medium</title>
            <link>https://medium.com/@camilledunning?source=rss-5a8b858c8370------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:06:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@camilledunning/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 Primer on Supervised and Unsupervised Machine Learning Models]]></title>
            <link>https://medium.com/ds3ucsd/a-primer-on-supervised-and-unsupervised-machine-learning-models-79fc4a109b51?source=rss-5a8b858c8370------2</link>
            <guid isPermaLink="false">https://medium.com/p/79fc4a109b51</guid>
            <category><![CDATA[machine-learni]]></category>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Camille Dunning]]></dc:creator>
            <pubDate>Thu, 26 Nov 2020 09:32:08 GMT</pubDate>
            <atom:updated>2020-11-29T23:14:04.473Z</atom:updated>
            <content:encoded><![CDATA[<p>As an aspiring machine learning engineer, I always tell people that I like to make computers think like humans.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*97wu3aUOUV0gpW3lKjGkRw.png" /><figcaption>Image by DS3 Marketing Team</figcaption></figure><p>…Okay, I knew I couldn’t fool you. To tell you the truth, what we do isn’t anything fancy, and it’s certainly not magic. This isn’t to say that what ML can accomplish isn’t remarkable: these mathematical models optimize our internet searches, drive cars, re-tailor education experiences for all sorts of individuals, predict sicknesses, and classify all objects with uncanny accuracy, breaking milestones at prophetic rates.</p><p>Academics tout their “AI solutions” as homologs to human reasoning, but the merit of doing so doesn’t really transcend the fact that these algorithms work by learning and improving based on previous iterations. We operate on introspection, planning, higher-order thinking, and self-reflection. We take in sequential information well. The machines that we train hone <a href="https://www.datasciencecentral.com/profiles/blogs/understanding-the-applications-of-probability-in-machine-learning">probability</a>, an ability to take in feedback on a continuous, cyclical basis, and pattern recognition. Much of the time, the “artificial mind” crunches numbers and “things” in a manner that remains a mystery to the general public.</p><p>So, what processes do ML algorithms undertake to achieve such eery results? They build internal models of the data (sensory information) and look for an underlying structure, sewing patterns from the top down. This is what is called an <strong>unsupervised learning</strong> task. Others take a bottom-up approach and generate their own assumptions about their outputs based on the correct answers they have learned before, similar to how we are taught in a classroom. This is the heart of <strong>supervised learning</strong>. Of course, these different workflows are saturated with moving parts beyond what most of us can comprehend, but the fundamental goals may not be as worthy of the reverence we hold them in.</p><p>I will be going over the mechanics of some elementary machine learning models and differentiating between the unsupervised and supervised ones, and discussing why each of them falls into their respective categories. Let’s start with some supervised algorithms.</p><h3>Supervised Learning 🟢</h3><h4>Linear Regression</h4><p>In simple terms, linear regression finds the best-fit line for describing the relationships between two or more variables. This is found by calculating the sum of the squared residuals from the observations to the predicted line. When we end up with a resultant line, we can express it as follows:</p><p><em>E</em>(<em>Y </em>| <em>X_1</em>,…, <em>X_p</em>)=<em>Y</em>=<em>β_0</em>+<em>β_1X_1</em>+…+<em>β_pX_p</em>, where:</p><ul><li><em>E</em> is the expected value.</li><li><em>Y</em> is the dependent variable, eventually designated as a function of the predictors.</li><li><em>X_i</em>, <em>i </em>= 1,…, <em>p</em> are the observations.</li><li><em>β_i</em>,<em>i </em>= 1,…, <em>p</em> are the degrees in change of the outcome for every unit of change in the predictor variable.</li><li><em>ε </em>is the disturbance, which represents variation in Y that is not caused by the predictors</li></ul><p>Note that a linear regression model has three main types of assumptions:</p><ol><li><strong>Linearity assumption</strong>: There is a linear relationship between the dependent and independent variables.</li><li><strong>Error term assumptions</strong>: <em>ε^</em>(i) are normally distributed, independent of each other, have a mean of zero, and have constant variance, <strong>σ</strong>^2 (homoscedasticity).</li><li><strong>Estimator assumptions</strong>: Independent variables are independent of each other (no multicollinearity) and measured without error.</li></ol><p>Linear regression is supervised 🟢. You are trying to predict a real number from the model you trained on your dataset of known dependent variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*TfMxiei0IcCnW3hJFNjGwg.png" /><figcaption>Visual from Backlog</figcaption></figure><h4>Linear Support Vector Machines (SVMs)</h4><p>SVMs detect classes in training data by finding the optimal hyperplane between the classes. This hyperplane must be optimal in the sense that it maximizes the margin, or separation, between the classes. This is used in both classification and regression problems, but SVM typically exemplifies the idea of a large margin classifier.</p><p>The geometric intuition behind classifier optimality is shown below. There are clearly infinitely many separators for the two classes (blue circles and X’s), but there is one that is equidistant from the two “blobs”. Therefore, we margin between the blue circles and the X’s is maximized. As for how this hyperplane is found, we take a subset of the training samples such that its elements are close to the decision surface, regardless of the class. Intuitively, SVM draws two parallel lines through the subset members of each class. These two parallel lines, in red below, are called support vectors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*QSaGk3GB8bU53r_KTLpKsA.png" /><figcaption>Image created by author</figcaption></figure><p>Eventually, the margin is maximized, and the line is drawn with the help of the support vectors. This optimal hyperplane will improve the classifier accuracy on new data points.</p><p>In our case, the dataset is linearly separable and has no noise or outliers, making it a <strong>hard margin SVM</strong>. However, <strong>soft-margin SVM</strong>s are preferred in practice because they are less susceptible to overfitting than are hard-margin SVMs and are more versatile as they can include some misclassified outliers.</p><p>Clearly, SVM is supervised 🟢. It requires the dataset to be fully labelled, hence the blue circles and the X’s. The only answer you’re trying to procure from SVM is the function describing the separation between the two known classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Z15sSnK9UohdrdakXnzXg.png" /><figcaption>Image from Velocity Business Solutions</figcaption></figure><h4>Naive Bayes</h4><p>You probably understand the Naive Bayes operates with Bayes’ Theorem, which gives you the posterior probability of an event given prior knowledge. We mathematically define it as follows:</p><p>P(<em>A</em>|<em>B</em>)=P(<em>B</em>|<em>A</em>)P(<em>A</em>) / P(<em>B</em>), where <em>A</em>, <em>B</em>=events</p><p>It’s also expressed as the true positive rate of an experiment divided by the sum of the false positive rate of a population and the true positive rate of the experiment. What’s interesting about Bayes’ Theorem is that it separates a test for an event from the event itself. You can read more about how this works <a href="https://betterexplained.com/articles/an-intuitive-and-short-explanation-of-bayes-theorem/">here</a>.</p><p>Naive Bayes is a binary and a multi-class classification algorithm in which predictions are simply made from calculating the probabilities of each data record associated with a particular class. The class having the largest probability for a data record is rated its most suitable class. Naive Bayes is an uncomplicated and fast algorithm and is a benchmark for text categorization tasks. It works well even with very large volumes of data.</p><p>Why is Naive Bayes “naive”, however? It calculates a conditional probability from other individual probabilities, implying independence of features, a fact we’ll almost never encounter in real life.</p><p>We can infer from looking at the formula that Naive Bayes is supervised 🟢. We need labels in our records to compute the probabilities for values of a certain feature given the label.</p><h3>Unsupervised Learning 🔴</h3><h4>Principal Component Analysis (PCA)</h4><p>Principal Component Analysis attempts to reduce dimensions in a dataset while preserving as much variance as possible, storing data points in vectors named “principal components”. These principal components are in descending order of how much variance in the dataset they carry. Visually, the data points are projected on to the principal axis. Below, PC 1 is the axis that preserves the maximum variance.</p><p>Finding PC 2 requires a linear <a href="https://en.wikipedia.org/wiki/Orthogonal_transformation">orthogonal transformation</a>. The amount of axes that PCA obtains is equal to the number of dimensions of the dataset so that every principal component is orthogonal to one another.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4W1rwVC28LSqWiLeVA0XPg.png" /><figcaption>Image from StatistiXL</figcaption></figure><p>Step by step, PCA is conducted by computing the covariance matrix, an example of which is shown below. Next, we decompose the covariance matrix to find its <a href="https://www.mathsisfun.com/algebra/eigenvalue.html"><strong>eigenvalues</strong></a>, denoted by λ, and corresponding <strong>eigenvectors</strong>. Geometrically, the eigenvector points in the resultant direction after the applied transformation, and it is stretched by a factor denoted by the eigenvalue. Therefore, the eigenvector gives us information about the direction of the principal component, while the eigenvalue tells us about its magnitude.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fcfNDaAqS_agQzgnG4lTAw.png" /><figcaption>Image from Wikipedia</figcaption></figure><p>Mathematically, we can express these terms as follows. Consider the linear differential operator, ddx, that scales its eigenvector (or <strong>eigenfunction</strong>). For example, <em>d</em>/<em>dx</em> <em>e</em>^(<em>λx</em>)=<em>λe</em>^(<em>λx</em>). In terms of matrices, let <em>A</em>_<em>n</em>×<em>n</em> denote a linear transformation, then the eigenvalue equation can be written as a matrix multiplication <em>A</em><strong><em>x</em></strong>=<em>λ</em><strong>x</strong>, where <strong><em>x</em> </strong>is the eigenvector. The set of all eigenvectors of a matrix associated with the same eigenvalue (including the zero vector) is called an <strong>eigenspace</strong>.</p><p>This math might look menacing, but you’ll have a firm understanding after you’ve completed one linear algebra course. It all boils down to geometric intuition.</p><p>Note that PCA won’t work well if you:</p><ol><li>Don’t have a <strong>linear relationship</strong> between your variables</li><li>Don’t have a large enough sample size</li><li>Don’t have data suitable for dimensionality reduction.</li><li>Have significant outliers</li></ol><p>PCA is an unsupervised algorithm 🔴. It learns without any target variable. We also tend to associate clustering techniques with unsupervised learning algorithms. People have contested about whether it can be considered a machine learning method at all since it’s used largely for preprocessing, but you can use the resultant eigenvectors to explain behavior in your data.</p><h4>K-Means Clustering</h4><p>Clustering excavates a dataset and discovers natural groupings, or clusters, within it, not necessarily disjoint. <em>K</em>-Means accomplishes this by computing the distance from a particular record to fixed numbers called <strong>centroids</strong>. As more records are “processed”, the centroids are redefined to equal the means of their corresponding groups. This is essentially the high-level description of the algorithm.</p><p>Theoretically, <em>K</em>-Means works to minimize its objective function, which is the squared error. The squared error expresses intra-cluster variance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*CXNq5vX7nNJpQiSOMXw3Lg.png" /><figcaption>Image created by author</figcaption></figure><ul><li><em>J</em> is the objective function.</li><li>k is the predefined number of clusters.</li><li><em>n</em> is the number of records.</li><li><em>x_i^</em>(<em>j</em>)is the <em>i</em>-th point in the <em>j</em>-th cluster.</li><li><em>c_j</em> is the <em>j-</em>th centroid.</li><li>||<em>x_i</em>^(<em>j</em>) — <em>c_j</em>||^2 is the Euclidean distance function.</li></ul><p>In practice:</p><ol><li><em>k</em> points are selected at random as cluster centroids.</li><li>Objects are assigned to a cluster according to its minimum Euclidean distance from each centroid.</li><li>Update the centroids. They will be recalculated as the mean of the objects in their analogous cluster.</li><li><strong>Stopping condition</strong>: The centroids do not change, or the objects remain in the same cluster, or the maximum number of iterations is reached.</li></ol><p>Below is a useful flowchart that visualizes the <em>k</em>-means algorithm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jSVQpOrxUZrJy33j3T3Cag.png" /><figcaption>Image from Revoledu</figcaption></figure><p><em>K</em>-Means clustering is one of the most popular and straightforward unsupervised learning algorithms 🔴. It infers the grouping solely from the Euclidean distance, and not any initial labels. However, there are semi-supervised variations of <em>k</em>-Means, such as <a href="https://arxiv.org/abs/1602.00360">semi-supervised <em>k</em>-means++</a>, that adopt partially labeled datasets to add “weights” to cluster assignment. Much of the time, “supervised” and “unsupervised” labels shouldn’t serve as limitations for machine algorithms, and certainly shouldn’t forestall new developments for alternative methods on the same dataset.</p><h4>Association Rules</h4><p>Finding interesting <strong>associations</strong> among data items is the leading unsupervised learning method after clustering. Association learning algorithms track the rates of complimentary cases in datasets, and make sure that these associations are found after random sampling. This approach is rule-based so it scales to categorical databases. I’ll briefly discuss its motivation and intuition.</p><p>Consider a database of 10,000 transactions from a store. It is found that 5,000 customers bought Item A and 8,000 bought Item B. Although at first glance, these transactions are statistically independent, but a second look at the dataset helps reveal that 2,000 bought both Items A and B. Not only did 50% of the customers buy Item A and 80% Item B, but 20% bought both items. This information has been useful for marketing strategies.</p><p>Rules are developed from these uncovered relationships. The composition of an association rule is as follows: an <strong>antecedent </strong>implies a <strong>consequent</strong>, and each element in both of these sets makes up an <strong>itemset</strong>. For example:</p><p>{<em>A</em>,<em>B</em>}⇒{<em>C</em>}; <em>I</em>={<em>A</em>,<em>B</em>,<em>C</em>}</p><p>Various metrics such as <strong>support</strong>, <strong>lift</strong>, and <strong>confidence</strong> help quantify the strengths of found associations. Support is expressed as the frequency of an itemset in a database, as calculated by the following:</p><p><em>supp</em>(<em>X</em>)=|{<em>t</em>∈<em>T</em>;<em>X</em>⊆<em>t</em>}| / |T|, where <em>T</em> is a database of transactions, and <em>X</em> is the itemset in question.</p><p>Confidence is the rate at which a rule such as <em>X</em>⇒<em>Y</em> is found to be true. It’s expressed as the proportion of transactions that contain <em>X</em> that also contain <em>Y</em>.</p><p><em>conf</em>(<em>X</em>⇒<em>Y</em>)=<em>supp</em>(<em>X</em>∪<em>Y</em>) / <em>supp</em>(<em>X</em>)</p><p>Lift of a rule is the ratio of the actual confidence and the expected confidence. How likely is Item B to be purchased when Item A is purchased, while still adjusting for how popular Item B is? It’s defined as follows:</p><p><em>lift</em>(<em>X</em>⇒<em>Y</em>)=<em>supp</em>(<em>X</em>∪<em>Y</em>) / <em>supp</em>(<em>X</em>)×<em>supp</em>(<em>Y</em>)</p><p>Some known algorithms that discover these rules are the Apriori algorithm, Eclat, and FP-growth. Again, no class labels are assigned to the datasets in use, and it works solely in its constraints to find relationships, so it is unsupervised 🔴.</p><h3>Conclusion</h3><p>I hope you found this article useful in differentiating unsupervised and supervised learning, and what segregates machine learning algorithms from our internal processes of problem solving and building intuition. However, the upper echelons of the artificial intelligence world are rapidly developing, with self-aware agents, deep learning, attention mechanisms, and so much more, aiming to mimic our own cognitive systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79fc4a109b51" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ds3ucsd/a-primer-on-supervised-and-unsupervised-machine-learning-models-79fc4a109b51">A Primer on Supervised and Unsupervised Machine Learning Models</a> was originally published in <a href="https://medium.com/ds3ucsd">Data Science Student Society @ UC San Diego</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Podcast Episode #9: Data Science in the Library with Stephanie Labou]]></title>
            <link>https://medium.com/ds3ucsd/podcast-episode-9-data-science-in-the-library-with-stephanie-labou-bf594c06a359?source=rss-5a8b858c8370------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf594c06a359</guid>
            <category><![CDATA[podcast]]></category>
            <category><![CDATA[library-usage]]></category>
            <category><![CDATA[data-vizualisation]]></category>
            <category><![CDATA[podcasting]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Camille Dunning]]></dc:creator>
            <pubDate>Fri, 25 Sep 2020 21:24:31 GMT</pubDate>
            <atom:updated>2020-11-26T08:48:11.299Z</atom:updated>
            <content:encoded><![CDATA[<p>This article recaps the main takeaways of our podcast episode with Stephanie Labou. Make sure to listen to the full podcast below or on <a href="https://ds3atucsd.podbean.com/e/data-science-in-the-library-with-stephanie-labou/">Podbean</a>. Follow us to stay tuned for more episodes!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fopen.spotify.com%2Fembed-podcast%2Fepisode%2F2BIUAcoK8GH07s3WUeQccs&amp;display_name=Spotify&amp;url=https%3A%2F%2Fopen.spotify.com%2Fepisode%2F2BIUAcoK8GH07s3WUeQccs&amp;image=https%3A%2F%2Fi.scdn.co%2Fimage%2F6849dd88d9ddd20f9cd840b090a54e27e16fae57&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=spotify" width="600" height="232" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ed33020a882430346e312cb779381b7/href">https://medium.com/media/1ed33020a882430346e312cb779381b7/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I7RDEFXGWNTkgv2ysjVBMQ.png" /></figure><p>For our ninth podcast episode, we are joined by the UCSD Library’s Data Science Librarian, Stephanie Labou. We begin by discussing with Stephanie about her practices as a Data Science Librarian, a seemingly unique job. She assists students with data acquisition and analysis while co-managing Geisel Libary’s Data and GIS Lab. She also engages in teaching through workshops in basic coding, data architecture, and software tools. Throughout this episode, we gather insights from Labou about the Library as a valuable resource for Data Scientists, and tips on producing practical Data Science projects. In the end, she helps students navigate through deciding on using public or private datasets.</p><p><a href="https://www.powr.io/photo-gallery/u/3559c856_1600734539">Stephanie Labou Media</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf594c06a359" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ds3ucsd/podcast-episode-9-data-science-in-the-library-with-stephanie-labou-bf594c06a359">Podcast Episode #9: Data Science in the Library with Stephanie Labou</a> was originally published in <a href="https://medium.com/ds3ucsd">Data Science Student Society @ UC San Diego</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Podcast Episode #9: Data Science in the Library with Stephanie Labou]]></title>
            <link>https://medium.com/@camilledunning/podcast-episode-9-data-science-in-the-library-with-stephanie-labou-abdfc94e08f0?source=rss-5a8b858c8370------2</link>
            <guid isPermaLink="false">https://medium.com/p/abdfc94e08f0</guid>
            <category><![CDATA[data-vizualisation]]></category>
            <category><![CDATA[podcasting]]></category>
            <category><![CDATA[library-usage]]></category>
            <category><![CDATA[podcast]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Camille Dunning]]></dc:creator>
            <pubDate>Tue, 22 Sep 2020 01:23:26 GMT</pubDate>
            <atom:updated>2020-09-22T01:29:19.320Z</atom:updated>
            <content:encoded><![CDATA[<p>This article recaps the main takeaways of our podcast episode with Stephanie Labou. Make sure to listen to the full podcast below or on <a href="https://ds3atucsd.podbean.com/e/data-science-in-the-library-with-stephanie-labou/">Podbean</a>. Follow us to stay tuned for more episodes!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fopen.spotify.com%2Fembed-podcast%2Fepisode%2F5JJ4vmMF2x0km5bPs6X3EP&amp;display_name=Spotify&amp;url=https%3A%2F%2Fopen.spotify.com%2Fepisode%2F5JJ4vmMF2x0km5bPs6X3EP&amp;image=https%3A%2F%2Fi.scdn.co%2Fimage%2F6849dd88d9ddd20f9cd840b090a54e27e16fae57&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=spotify" width="600" height="232" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee4e3b909c906566b5ddccf47037d8c4/href">https://medium.com/media/ee4e3b909c906566b5ddccf47037d8c4/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ma3lAvRglRJ16KonrrxanA.png" /></figure><p>For our ninth podcast episode, we are joined by the UCSD Library’s Data Science Librarian, Stephanie Labou. We begin by discussing with Stephanie about her practices as a Data Science Librarian, a seemingly unique job. She assists students with data acquisition and analysis while co-managing Geisel Libary’s Data and GIS Lab. She also engages in teaching through workshops in basic coding, data architecture, and software tools. Throughout this episode, we gather insights from Labou about the Library as a valuable resource for Data Scientists, and tips on producing practical Data Science projects. In the end, she helps students navigate through deciding on using public or private datasets.</p><h3>Media</h3><p><a href="https://www.powr.io/photo-gallery/u/3559c856_1600734539">Stephanie Labou Media</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abdfc94e08f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Podcast Episode #5: Industry Relations and Networking Advice with Erik Mjoen]]></title>
            <link>https://medium.com/ds3ucsd/podcast-episode-5-industry-relations-and-networking-advice-with-erik-mjoen-db14f845d9e4?source=rss-5a8b858c8370------2</link>
            <guid isPermaLink="false">https://medium.com/p/db14f845d9e4</guid>
            <category><![CDATA[industry]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Camille Dunning]]></dc:creator>
            <pubDate>Mon, 08 Jun 2020 19:37:09 GMT</pubDate>
            <atom:updated>2020-06-08T19:37:09.226Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article recaps our podcast episode with Erik Mjoen. Be sure to listen to the full podcast below or on </em><a href="https://ds3atucsd.podbean.com/"><em>Podbean</em></a><em> and follow us to get notified about new episodes!</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fopen.spotify.com%2Fembed-podcast%2Fepisode%2F4TR2qd35NjnpFdWpIjS1yV&amp;display_name=Spotify&amp;url=https%3A%2F%2Fopen.spotify.com%2Fepisode%2F4TR2qd35NjnpFdWpIjS1yV&amp;image=https%3A%2F%2Fi.scdn.co%2Fimage%2F6849dd88d9ddd20f9cd840b090a54e27e16fae57&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=spotify" width="600" height="232" frameborder="0" scrolling="no"><a href="https://medium.com/media/c2791c8adb67c402378cc7a517bdd998/href">https://medium.com/media/c2791c8adb67c402378cc7a517bdd998/href</a></iframe><p>Erik Mjoen is the Industry Relations Manager at UC San Diego’s Halıcıoğlu Data Science Institute (HDSI), where he focuses on facilitating networking, leadership, partnership, and innovation. In this episode, we talk with him about his experiences in Industry Relations, his advice to students seeking industry opportunities, and his tips on soft and hard skills.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EEJbXoc57zcJRmCvNXztMw.jpeg" /></figure><h3>His Work</h3><p>As an Industry Relations manager, Mjoen’s responsibilities entail overseeing research, leadership, partnerships, and developments in Data Science. Most of his daily activities involve meetings with companies, in hopes of establishing a collaboration between them and the HDSI. To establish partnerships, these companies must have a clear vision of what their goals are, how they will benefit from this partnership, and how they will utilize the resources.</p><p>Aside from meetings, Mjoen focuses on connecting students with companies by planning career fairs and other events for students to gain exposure to industry.</p><p>Mjoen’s work does not strictly pertain to either academia or industry. Rather, he is the liaison between both, which means he has a diverse set of tasks to work on and events to plan, so his day-to-day routine often varies.</p><p>He started his journey toward his current role in college, where he studied International Business and minored in Economics. He then worked in various international firms in San Diego, zeroing in on technological innovation during the dot-com boom, and eventually running his own recruitment business. Seeking a different path later on, he was introduced to UCSD and got his first job at the Career Center, focusing on industry engagement for technology and engineering. Over time, he familiarized himself with the university’s engineering talent.</p><p>Mjoen has worked at UCSD for more than three years and found that the university is a bastion for innovation and discovery. Both its faculty and student body are forward-thinking, and HDSI, in particular, strives to help “the next generation of innovators and leaders.”</p><h3>Four Quadrants of Industry Relations</h3><p>HDSI’s industry partnership framework can be broken down into four parts, according to Mjoen.</p><p>The first of these is Research and Innovation, which consists of engaging faculty and students, usually graduate-level, in solving complex problems. By working on these projects, students partake in addressing real-world issues all across the spectrum, as the faculty are very diverse in their domain knowledge. What is unique about HDSI is that it seeks to expand these experiences into the undergraduate curriculum.</p><p>The second part is Recruitment and Talent, which Mjoen argues is the most important because it cultivates competition and diversity in the marketplace. HDSI’s partners may set up internship and hiring goals, and they’ll in turn get assistance in meeting those goals as well as building recruitment brands.</p><p>The third part is Continued Learning, which serves to keep current professionals informed about the evolution of the Data Science field and the industries that apply its numerous moving parts. Faculty lectures and comprehensive workshops cultivate Continued Learning.</p><p>Leadership comprises the fourth quadrant and aims to foster the Data Science curriculum lends itself to the necessary industry skill — sets. This area fosters two-way communication and collaboration, and it ensures that academic faculty and companies can learn from each other through facilitating relevant research endeavors.</p><h3>Career Advice for Students</h3><p>When planning out their careers, Mjoen stresses that students should concentrate more on the learning process and less on acquiring the most impressive-sounding job title offered by a top-grossing company. Also, as important as hard skills are, students should continually practice their soft skills and networking skills.</p><p>Many networks in our daily lives are outside the workplace: our friends, classmates, families, and others. Therefore, our aptitude in networking grows only with constant practice in every situation. Mjoen explains that a strong network is what paves the way for opportunities, and we must be vigilant of any opportunities that spring up in which we can make new connections. The doors that open up are almost always unpredictable, and it’s up to us to maintain strong connections through relationship-building and reaching out to people in our network.</p><p>Mjoen notes that networking is proactive not passive. As uncomfortable as it may seem, seeking out an employer or industry expert in person, as opposed to drafting an online application, will leave a more lasting impression. Doing so also increases the chances of follow-ups. Additionally, it’s better to follow-up upon meeting these recruiters to further the odds of them securing a place in your network and vice versa.</p><p>Having an elevator pitch also comes in handy, says Mjoen. With it, you can tell your story and your goals succinctly and efficiently. These should generally last 30 to 60 seconds.</p><p>For more insight about Mjoen’s efforts in pioneering for industry-academia alliances, go to <a href="https://datascience.ucsd.edu/industry/">this link</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db14f845d9e4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ds3ucsd/podcast-episode-5-industry-relations-and-networking-advice-with-erik-mjoen-db14f845d9e4">Podcast Episode #5: Industry Relations and Networking Advice with Erik Mjoen</a> was originally published in <a href="https://medium.com/ds3ucsd">Data Science Student Society @ UC San Diego</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Overview of Hierarchical Cluster Analysis (HCA)]]></title>
            <link>https://medium.com/ds3ucsd/an-overview-of-hierarchical-cluster-analysis-hca-84f37f99bc7c?source=rss-5a8b858c8370------2</link>
            <guid isPermaLink="false">https://medium.com/p/84f37f99bc7c</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[clustering]]></category>
            <category><![CDATA[unsupervised-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Camille Dunning]]></dc:creator>
            <pubDate>Tue, 28 Apr 2020 00:47:41 GMT</pubDate>
            <atom:updated>2020-04-28T00:47:41.692Z</atom:updated>
            <content:encoded><![CDATA[<h3>Clustering in Sum</h3><p>In Data Science, big, messy problem sets are unavoidable. If we keep them as such, every step of the analytical process will be much more cumbersome. Given this, it’s inarguable that we would want a way to view our data at large in a logical and organized manner.</p><p>Clustering is one of the most popular methods in data science and is an unsupervised Machine Learning technique that enables us to find structures within our data, without trying to obtain specific insight. In cluster analysis, we partition our dataset into groups that share similar attributes. The math blog, Eureka!, put it nicely: we want to assign our data points to clusters such that there is “high intra-cluster similarity” and “low inter-cluster similarity.” Here are some examples of real-life applications of clustering.</p><p>One example is in the marketing industry. Clustering algorithms have proven to be effective in producing what they call “market segments” in market research. For each market segment, a business may have different criteria for catering to their needs and effectively marketing their product or service.</p><p>For example, when plotting customer satisfaction (CSAT) score and customer loyalty (Figure 1), clustering can be used to segment the data into subgroups, from which we can get pretty unexpected results that may stimulate experiments and further analysis. In this case, we attained a whole cluster of customers who are loyal but have low CSAT scores.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/0*LLIxnBxyWgMq_rvp" /><figcaption>Figure 1: Visual from Segmentation Study Guide</figcaption></figure><p>Clustering algorithms — particularly k-means (k=2) clustering– have also helped speed up spam email classifiers and lower their memory usage. They have also made headway in helping classify different species of plants and animals, organizing of assets, identifying frauds, and studying housing values based on factors such as geographic location.</p><p>Let us proceed and discuss a significant method of clustering called hierarchical cluster analysis (HCA). This article will assume some familiarity with <em>k</em>-means clustering, as the two strategies possess some similarities, especially with regard to their iterative approaches.</p><h3>Hierarchical Clustering</h3><p>HCA is a strategy that seeks to build a <strong>hierarchy </strong>of clusters that has an established ordering from top to bottom. <em>K</em>-means would not fall under this category as it does not output clusters in a hierarchy, so let’s get an idea of what we want to end up with when running one of these algorithms. A “hierarchy of clusters” is usually represented by a <strong>dendrogram</strong>, shown below (Figure 2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*RplrOjrCQNDI18tY2uFz9w.png" /><figcaption>Figure 2: Visual from Data Viz Project</figcaption></figure><p>For instance, a dendrogram that describes scopes of geographic locations might have a name of a country at the top,, then it might point to its regions, which will then point to their states/provinces, then counties or districts, and so on.</p><p>To create a dendrogram, we must compute the similarities between the attributes. Note that to compute the similarity of two features, we will usually be utilizing the Manhattan distance or Euclidean distance. These distances would be recorded in what is called a <strong>proximity matrix</strong>, an example of which is depicted below (Figure 3), which holds the distances between each point. We would use those cells to find pairs of points with the smallest distance and start linking them together to create the dendrogram. I will not be delving too much into the mathematical formulas used to compute the distances between the two clusters, but they are not too difficult and you can read about it <a href="https://en.wikipedia.org/wiki/Hierarchical_clustering">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/0*o-dckPKER2QTKXbN" /><figcaption>Figure 3: Visual from Revoledu</figcaption></figure><p>I will describe how a dendrogram is used to represent HCA results in more detail later. For now, consider the following heatmap of our example raw data. We will assume this heat mapped data is numerical. In case you aren’t familiar with heatmaps, the different colors correspond to the magnitude of the numerical value of each attribute in each sample. Light colors here, for example, might correspond to middle values, dark orange might represent high values, and dark blue might represent lower values. Darker colors usually refer to extreme values in a numerical dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*nULQZCpf1xOAKPgbUpdQfg.png" /></figure><p>We see that based on the patterns in each row, Attribute #1 and Attribute #3 are similar. We will “cluster” them as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*PL630pKocZ3qKRU6Ds74Dg.png" /></figure><p>Now, we have a cluster for our first two similar attributes, and we actually want to treat that as one attribute. We now want to figure out which of Attribute #2 and Attribute #4 are most similar to Cluster #1. We then compare the three clusters, but we find that Attribute #2 and Attribute #4 are actually the most similar. Thus, we end up with the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*HYJZQI9MWLygLYj5LDyc7A.png" /></figure><p>Finally, since we now only have two clusters left, we can merge them together to form one final, all-encompassing cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*MEG5_nS1m9hfw4DO-sF7VA.png" /></figure><p>Now, here’s how we would summarize our findings in a dendrogram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*O6IxmTQh2h_dR49P80mCGA.png" /></figure><p>Notice the differences in the lengths of the three branches. The original cluster we had at the top, Cluster #1, displayed the most similarity and it was the cluster that was formed first, so it will have the shortest branch. Cluster #2 had the second most similarity and was formed second, so it will have the second shortest branch. The longest branch will belong to the last Cluster #3 since it was formed last.</p><p>Hence, the dendrogram indicates both the similarity in the clusters and the sequence in which they were formed, and the lengths of the branches outline the hierarchical and iterative nature of this algorithm. Under the hood, we will be starting with k=N clusters, and iterating through the sequence N, N-1, N-2,…,1, as shown visually in the dendrogram.</p><p>There are two different approaches used in HCA: <strong>agglomerative </strong>clustering and <strong>divisive </strong>clustering.</p><h3>Agglomerative Hierarchical Clustering</h3><p>This is the more common out of the two approaches, and essentially what I just described above. The process can be summed up in this fashion:</p><p>Start by assigning each point to an individual cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*jIKgP8rxvUu6T8en59zBQQ.png" /></figure><p>At each iteration, we’ll merge clusters together and repeat until there is only one cluster left. In this case, the light blue cluster is our last cluster and its branch will be the longest and at the end on the dendrogram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*-0Hm1riXHUnyCQqSl-LeDg.png" /></figure><p>Since each of our observations started in their own clusters and we moved up the hierarchy by merging them together, agglomerative HC is referred to as a <strong>bottom-up</strong> approach.</p><h3>Divisive Hierarchical Clustering</h3><p>A <strong>top-down</strong> procedure, divisive hierarchical clustering works in reverse order. We start with one cluster, and we recursively split our enveloped features into separate clusters, moving down the hierarchy until each cluster only contains one point. The algorithm is along these lines:</p><p>Assign all N of our points to one cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/278/1*zR7cOoeIK5Sd5O3wza86vQ.png" /></figure><p>At each iteration, we will split the farthest data point from the rest from this larger cluster and assign it to its own.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*5RKWem6XXbdtR4q9b9qaiQ.png" /></figure><p>This will continue until N singleton clusters remain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*2zcodmT_v2uomxqhbCZd7Q.png" /></figure><h3>Takeaways</h3><p>There are several advantages associated with using hierarchical clustering: it shows all the possible links between clusters, it helps us understand our data much better, and while <em>k</em>-means presents us with the luxury of having a “one-size-fits-all” methodology of having to preset the number of clusters we want to end up with, doing so is not necessary when using HCA. However, a commonplace drawback of HCA is the lack of scalability: imagine what a dendrogram will look like with 1,000 vastly different observations, and how computationally expensive producing it would be!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84f37f99bc7c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ds3ucsd/an-overview-of-hierarchical-cluster-analysis-hca-84f37f99bc7c">An Overview of Hierarchical Cluster Analysis (HCA)</a> was originally published in <a href="https://medium.com/ds3ucsd">Data Science Student Society @ UC San Diego</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python, Functional Programming, and Mathematical Computation for Data Science]]></title>
            <link>https://medium.com/ds3ucsd/test-camille-d61bd95dc550?source=rss-5a8b858c8370------2</link>
            <guid isPermaLink="false">https://medium.com/p/d61bd95dc550</guid>
            <category><![CDATA[computation]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[linear-algebra]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Camille Dunning]]></dc:creator>
            <pubDate>Thu, 21 Nov 2019 20:36:50 GMT</pubDate>
            <atom:updated>2019-11-21T20:47:05.825Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ua_ilBqWGoEwcOdSqWQ76g.png" /></figure><p>You are probably well aware of Python’s flying demand in almost every discipline of computer science. Python dominates in programming for embedded systems, network engineering, back-end web development, and of course, Data Science. Its success is owed to its wide range of applications as well as its user-friendliness: a Python program is almost always at least a few times shorter than its equivalent Java program and more than several times shorter than its analogous C++ program. With its versatility, maturity, and emphasis on clarity, Python rests comfortably in the tech stacks of titan companies Facebook, Google, Instagram, Spotify, and Netflix.</p><p>In this article, I will be providing a survey of one of Python’s key industry capabilities: computation, specifically in the domain of Data Science. Mathematical calculation and computational statistics are the crust of the data scientist pie; they govern the efficiency and structure of any model you will build and test in your Data Science career. Python retains a comprehensive collection of third-party libraries as well as vanilla tools to help with this. Let us take a look at some of Python’s computational components. We will begin with higher-order functions.</p><h3>Higher-Order Functions</h3><p><strong>Higher-order functions</strong> are part of Python’s <a href="https://www.sitepoint.com/what-is-functional-programming/">functional programming</a> paradigm and are used when users want to minimize moving parts in their code. They handle other functions by either taking them as input arguments or returning them. What makes this possible is the state of any Python function as a <strong>first-class object</strong>. First-class objects can be stored in data structures, can be returned from another function, assigned to a variable, and passed as a parameter to another function.</p><p>A familiar example of a higher-order function in Python is <em>filter</em>. Consider a problem in which you are given a collection of integers, and you want out of the list only the multiples of six. You might create a <em>number_list</em> that contains the integers, and a <em>mult_six</em> list to contain the multiples of six. Imperatively, you might use a <em>for</em> loop to iterate over each element of <em>number_list</em> and check if it is a multiple of six, and if that is true, append <em>number_list[i]</em> to <em>mult_six</em>.</p><p>This is fine, but we can use <em>filter</em> to take a more declarative approach to this problem. To illustrate the higher-order functionality, we will define a <em>multiple_of_six()</em> function:</p><pre>def multiple_of_six(num):<br>    if num % 6 == 0:<br>        return True<br>    else:<br>        return False</pre><p>The imperative approach with an arbitrary <em>number_list</em>:</p><pre>number_list = [24, 74, 14, 75, 12, 72]<br>mult_six = []</pre><pre>for n in number_list:<br> if multiple_of_six(n) == True:</pre><pre>mult_six.append(n)</pre><pre># Returns [24, 12, 72]</pre><pre>mult_six</pre><p>Now, let’s try this using <em>filter</em>. <em>filter()</em> will take in a function and a sequence, and it will output the items in the sequence for which that function returns <em>True</em>.</p><pre>f = filter(multiple_of_six, number_list)<br>for i in f:<br> <em># Prints 24, 12, 72</em><br> print(i)</pre><p>High-order functions in Python enable us to make multiple computations in just one beautiful line of code. Other noteworthy higher-order functions are <em>map</em> and <em>reduce</em>. The next type of function we’ll examine works similarly to a mathematical function and reduces bugs in computation.</p><h3>Pure Functions</h3><p><strong>Pure functions</strong> don’t operate on global variables or any objects outside the function’s scope. When we use an <strong>impure function</strong>, we follow the typical scheme of defining a global variable and a function that manipulates it (i.e. takes it as an argument) and applying the function to it through a function call. When we rerun the function with the same input, we aren’t guaranteed to get the same output. The opposite is true for pure functions as it doesn’t change the state of any variable. A pure function is also described as <strong>deterministic</strong>.</p><p>Consider a function that adds two integers. It takes one argument, <em>b</em>, to add to a pre-defined global variable <em>a</em>.</p><pre>a = 3 <br>def addition(b):<br> return a + b</pre><pre><em># Returns 7</em><br>addition(4)</pre><p>You’re probably expecting the value of <em>addition(4)</em> to be different if we change the value of <em>a</em>.</p><pre>a = 7</pre><pre><em># Returns 11</em><br>addition(4)</pre><p><em>addition</em> is <strong>impure</strong> because its output does depend on the value of a global variable. There is a determinant of the result that is outside the scope of addition. Let’s “purify” this function by making it depend only on its inputs, eliminating all <strong>side effects</strong>:</p><pre>def addition_pure(a, b):<br> Return a + b</pre><pre><em># Returns 8, the same output each time we run the function with the same inputs</em><br>addition(6, 2)<br>addition(6, 2)<br>addition(6, 2)</pre><p>Let’s think about a couple of other examples: a function that reads files and a function that depends on a randomly generated number. It should be obvious that neither of these functions is pure: both of these inputs are <strong>mutable</strong>. File names can change and random number generators never produce immutable results. A benefit of pure functions is that they are isolated and can’t affect any other parts of their program. This will reduce the risk of bugs, instability, and trials with testing, and improve clarity.</p><h3>Anonymous Functions</h3><p>You already know that we define a function using the <em>def</em> keyword and immediately follow it with a name. However, this might be futile if we only want to use it in one very specific instance. This is where <strong>anonymous/lambda functions</strong> come in handy. Anonymous functions don’t have names and are instantiated using the <em>lambda</em> keyword. These functions derive from a simple model of computation known as <a href="https://en.wikipedia.org/wiki/Lambda_calculus">lambda calculus</a> which is based on <strong>function abstraction</strong>.</p><p>Lambda functions have raised controversy due to their confusing syntax and imposition of a functional way of thinking, but they are a convenient shorthand for applying a function to a collection of arguments. Note that lambda functions can have any number of arguments but only one expression, which is automatically returned without the need for a <em>return</em> statement. Let’s attend to some examples.</p><p>A lambda function declaration has the following composition: the keyword (<em>lambda</em>), <strong>bound variables</strong> (the arguments), and a body (the expression). Here’s a very simple lambda function:</p><pre>lambda x: x**3</pre><p>We can see that this is similar to writing:</p><pre>def cube(x):<br> return x**3</pre><p>We can call a lambda function on an arbitrary bound value like so:</p><pre><em># Returns 64</em><br>(lambda x: x**3)(4)</pre><p>It is also valid to assign a lambda function to a variable name and call from that variable name instead. Multiple arguments can be fed into a lambda function:</p><pre><em># Returns 16</em><br>(lambda x, y: x ** y)(4, 2)</pre><p>Finally, a useful feature of lambda functions is that they are harmonious with higher-order functions:</p><pre><em># Returns 8</em><br>(lambda x, addition: x * addition(x))(2, lambda x: x + x)</pre><p>This doesn’t look attractive at all, so let’s break it down: we write a <em>lambda</em> function with two arguments as before, with the second argument being a function. In the call statement, we define the body of the addition function. This is the exact same approach as in the previous example, where we defined the second argument of our lambda function, <em>y</em>, to be 2. This illustrates why Python functions are a first-class entity, as well as <em>lambda</em>’s parallelism to a regular defined function. The cleverness of the anonymous function obviously comes at the cost of readability and the natural syntax Python is known for. Nonetheless, it’s proven to be valuable for tasks including sorting, concatenating, writing classes, among others.</p><p>I just explained the general styles and structures that occur within functional programming. FP’s approach of avoiding mutable data and shared-state variables and pure calculation lends itself well to mathematical and statistical computation. Although Python isn’t a purely functional programming language like Haskell or Clojure, Python FP has repeatedly established itself in Data Science, machine learning, and computational statistics. If you have experience in deep learning, you can say that the higher-order-chain nature of FP over a data structure works the same way as a neural network when it’s given a simple matrix of data.</p><h3>Linear Algebra Using NumPy</h3><p>We will now shift gears and briefly discuss some of Python’s capabilities in computational linear algebra. Linear algebra is arguably one of the most crucial mathematical fields a data scientist must study. A lot of scientific and statistical computing problems can be represented with linear algebra, and it’s hard to identify a common Data Science problem that doesn’t employ matrix operations, vectorization, decomposition, etc.</p><p>I will not be diving deeply into the mathematical theory behind linear algebra, but rather common algorithms implemented by NumPy. NumPy is Python’s main library for performing mathematical computations, specifically on vectors and matrices. It is also the basis for plenty of other Python Data Science and machine learning libraries. NumPy’s versatility in computation is what has cajoled data scientists and machine learning engineers into using Python. Let’s introduce and demonstrate various important linear algebra operations in NumPy, starting with creating a simple multidimensional array.</p><h4>Create a Multidimensional Array</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/0*ZmlNKbTeF00iBPyl" /><figcaption><a href="https://hadrienj.github.io/posts/Deep-Learning-Book-Series-2.1-Scalars-Vectors-Matrices-and-Tensors/">https://hadrienj.github.io/posts/Deep-Learning-Book-Series-2.1-Scalars-Vectors-Matrices-and-Tensors/</a></figcaption></figure><p>You are likely familiar with scalars, vectors, and matrices. We know that in any programming language, a matrix is written as a 2D array. You’ve also likely come across arrays of more than two dimensions, or <em>n</em>-dimensional arrays.</p><p><strong>Remark</strong><em>:</em> A ‘tensor’ is a <strong>type</strong> of function, whereas an <em>n</em>-dimensional array is the corresponding data structure. A tensor is a type of <em>n</em>-dimensional array with specific linear <a href="https://en.wikipedia.org/wiki/Tensor">transformation properties</a> under matrix operations.</p><p>Let us use NumPy to generate a simple 3-dimensional array. Our approach will be to use <em>np.zeros()</em>, with a tuple (<em>i</em>,<em> j</em>,<em> k</em>) as an argument, where the length of the tuple equals the dimension of the array, and the values <em>i</em>, <em>j</em>, <em>k</em> correspond to the number of elements in each dimension. The ordered triple we input is called the <strong>shape</strong> of our <em>n</em>-dimensional array. <em>np.zeros() </em>will simply create an array filled with 0. We can use <em>numpy.array()</em> to create an <em>n</em>-dimensional array with specified non-zero values.</p><p>For example:</p><pre>&gt;&gt;&gt; import numpy as np<br>&gt;&gt;&gt; array = np.zeros(1, 2, 3)<br>&gt;&gt;&gt; array<br>array([[[0., 0., 0.],<br> [0., 0., 0.]]])<br>&gt;&gt;&gt; np.ndim(array) <em># Get number of dimensions of array</em><br>3</pre><p>Some other matrix operations the NumPy library can quickly perform include, but aren’t limited to:</p><ul><li>Element-wise addition, subtraction</li><li>Element-wise multiplication, division</li><li>Cross product, dot product</li><li>Transposition</li><li>Inner and outer product</li><li>Generation of the identity matrix</li><li>Matrix multiplication</li><li>Matrix inversion</li><li>Determinant, trace</li></ul><p>Check the numpy.linalg <a href="https://docs.scipy.org/doc/numpy/reference/routines.linalg.html">documentation</a> for more advanced matrix operations and details.</p><h4>Example: Norms with NumPy</h4><p>In linear algebra, a <strong>norm</strong> is a “function that assigns a strictly positive length or size to each vector in a vector space — except for the zero vector, which is assigned to a length of zero. Consider the two-dimensional Euclidean space ℝ². The ℝ² space supplies the “Euclidean norm,” which assigns to a vector the length of its arrow drawn in the Cartesian coordinate system. This is what we know as the <strong>magnitude</strong> of a vector!</p><p>Formally, the norm on a vector space <em>V</em> is a positive-valued scalar function: <em>V</em> → [0, <strong>∞</strong>) that satisfies the following, with <strong>u</strong>,<strong>v</strong>∈<em>V </em>(<strong>u</strong>,<strong>v</strong> are vectors):</p><ol><li><em>f</em>(<strong><em>u</em></strong><em>+</em><strong><em>v</em></strong>) ≤ <em>f</em>(<strong>u</strong>)+<em>f</em>(<strong>v</strong>) (see <a href="https://www.britannica.com/science/triangle-inequality">triangle inequality</a>)</li><li><em>f</em>(<em>a</em><strong>v</strong>)=|<em>a</em>|<em>f</em>(<strong>v</strong>) (absolutely homogeneous, <em>a</em>∈ℝ)</li><li><em>f</em>(<strong>v</strong>) = 0<strong> </strong>→ <strong>v</strong><em> </em>= <strong>0</strong> is the zero vector</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/0*saXV977pLdXatiTc" /><figcaption><a href="https://hadrienj.github.io/posts/Deep-Learning-Book-Series-2.5-Norms/">https://hadrienj.github.io/posts/Deep-Learning-Book-Series-2.5-Norms/</a></figcaption></figure><p>For example:</p><pre><strong>&gt;&gt;&gt; </strong>u = np.array([5, 1])<br><strong>&gt;&gt;&gt; </strong>v = np.array([6, 2])<br><strong>&gt;&gt;&gt; </strong>np.linalg.norm(u + v)<br>11.40175425099138<br><strong>&gt;&gt;&gt; </strong><em># Geometrically, this is the shortest line between the two vectors, assuming they are in tip-to-tail form.</em></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d61bd95dc550" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ds3ucsd/test-camille-d61bd95dc550">Python, Functional Programming, and Mathematical Computation for Data Science</a> was originally published in <a href="https://medium.com/ds3ucsd">Data Science Student Society @ UC San Diego</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>