Why is Linear Algebra Useful?

365 Data Science · Beginner ·🔢 Mathematical Foundations ·7y ago

Key Takeaways

The video explains the usefulness of linear algebra in data science, covering topics such as vectorizing code, image recognition, and dimensionality reduction, with a focus on machine learning and deep learning applications.

Full Transcript

why is linear algebra actually useful there are very many applications of linear algebra in data science in particular there are several ones of high importance some are easy to grasp others not just yet in this lesson we will explore three of them vectorizing code also known as a ray programming image recognition dimensionality reduction ok let's start from the simplest and probably the most commonly used one vectorized code we can certainly claim that the price of a house depends on its size suppose you know that the exact relationship for some neighborhood is given by the equation price equals ten thousand one hundred and ninety plus two hundred and twenty three times size moreover you know the sizes of five houses 693 656 1060 487 and 1275 square feet what you want to do is plug in each size in the equation and find the price of each house right well for the first one we get ten thousand one hundred and ninety plus two hundred and twenty three times six hundred and ninety-three equals one hundred and sixty four thousand seven hundred and twenty nine then we can find the next one and so on until we find all prices now if we have 100 houses doing that by hand would be quite tedious wouldn't it one way to deal with that problem is by creating a loop you can iterate over the sizes multiplying each of them by 223 and adding 10,000 190 however we are smarter than that aren't we we know some linear algebra already let's explore these two objects five by two matrix and a vector of length two the matrix contains a column of ones and another with the sizes of the houses the vector contains 10,000 190 and 223 the numbers from the equation if we go about multiplying them we will get a vector of length five the first element will be equal to one times ten thousand 190 plus 693 times 223 the second to one times ten thousand 190 plus 656 times 223 and so on by inspecting these expressions we quickly realize that the resulting vector contains all the manual calculations we made earlier to find the prices in machine learning and linear regressions in particular this is exactly how algorithms work we've got an inputs matrix a weights or a coefficients matrix and an output matrix without diving too deep into the mechanics of it here let's note something if we have 10,000 inputs the initial matrix would be 10,000 by 2 right the weights matrix would still be 2 by 1 when we multiply them the resulting output matrix would be 10,000 by 1 this shows us that no matter the number of inputs we will get just as many outputs moreover the equation doesn't change as it only contained the two coefficients 10,000 190 and 223 all right so whenever we are using linear algebra to compute many value simultaneously we call this array programming or vectorizing code it is important to stress that array programming is much much faster there are libraries such as numpy that are optimized for performing this kind of operations which greatly increases the computational efficiency of our code okay what about image recognition in the last few years deep learning and deep neural networks in particular conquered image recognition on the forefront our convolutional neural networks or CN NS in short what is the basic idea you can take a photo feed it to the algorithm and classify it famous examples are the emne Stata set where the task is to classify handwritten digits Sipho are 10 where the task is to classify animals and vehicles and sigh far 100 where you have 100 different classes of images the problem is that we cannot just take a photo and give it to the computer we must design a way to turn that photo into numbers in order to communicate the image to the computer here's where linear algebra comes in each photo has some dimensions right say this photo is 400 by 400 pixels each pixel in a photo is basically a colored square give it enough pixels and a big enough zoom out causes our brain to perceive this as an image rather than a collection of squares let's dig into that here's a simple grayscale photo the grayscale contains 256 shades of grey where zero is totally white and 255 is totally black or vice versa we can actually express this photo as a matrix if the photo is 400 by 400 and that's a 400 by 400 matrix element of that matrix is a number from zero to 255 it shows the intensity of the color gray and that pixel that's how the computer sees a photo but greyscale is boring isn't it what about colored photos well so far we had two dimensions width and height while the number inside corresponding to the intensity of color what if we want more colors well one solution mankind has come up with is the RGB scale where RGB stands for red green and blue the idea is that any color perceivable by the human eye can be decomposed into some combination of red green and blue where the intensity of each color is from 0 to 255 a total of 256 shades in order to represent a colored photo in some linear algebraic form we must take the example from before and add another dimension color so instead of a 400 by 400 matrix we get a 3 by 400 by 400 tensor this tensor contains three 400 by 400 matrices one for each color red green and blue and that's how deep neural networks work with photos great finally dimensionality reduction since we haven't seen eigenvalues and eigenvectors yet there is not much to say here except for developing some intuition imagine we have a data set with three variables visually our data may look like this in order to represent each of those points we have used three values one for each variable x y&z therefore we are dealing with an M by three matrix so the point I corresponds to a vector X I Y I and Zi note that those three variables XY and Z are the three axes of this plane here's where it becomes interesting in some cases we can find a plane very close to the data something like this this plane is two-dimensional so it is defined by two variables say U and V all points lie on this plane but we can approximately say that they do linear algebra provides us with fast and efficient ways to transform our initial matrix from M by three where the three variables are X Y & Z into a new matrix which is M by 2 where the two variables are U and V in this way instead of having three variables we reduce the problem to two variables in fact if you have 50 variables you can reduce them to 40 or 20 or even 10 how does that relate to the real world why does it make sense to do that well imagine a survey where there is a total of 50 questions three of them are the following please rate from one to five one I feel comfortable around people to I easily make friends and three I like going out now these questions may seem different but in the general case they aren't they all measure your level of extraversion so it makes sense to combine them right that's where dimensionality reduction techniques and linear algebra come in very very often we have too many variables that are not so different so we want to reduce the complexity of the problem by reducing the number of variables thanks for watching if you found this video interesting and want to gain an edge in your career make sure to LIKE comment and subscribe and don't forget to check out some of our other videos for another quick win in the data science skills department

Original Description

👉Sign up for Our Complete Data Science Training with 57% OFF: https://bit.ly/3sJATc9 👉 Download Our Free Data Science Career Guide: https://bit.ly/47Eh6d5 Why is linear algebra actually useful? There very many applications of linear algebra. In data science, in particular, there are several ones of high importance. Some are easy to grasp, others not just yet. In this lesson, we will explore 3 of them: • Vectorized code also known as array programming • Image recognition • Dimensionality reduction Okay. Let’s start from the simplest and probably the most commonly used one – vectorized code. We can certainly claim that the price of a house depends on its size. Suppose you know that the exact relationship for some neighborhood is given by the equation: Price equals 10,190 + 223 times size. Moreover, you know the sizes of 5 houses 693, 656, 1060, 487, and 1275 square feet. What you want to do is plug-in each size in the equation and find the price of each house, right? Well, for the first one we get: 10190 + 223 times 693 equals 164,729. Then we can find the next one, and so on, until we find all prices. Now, if we have 100 houses, doing that by hand would be quite tedious, wouldn’t it? One way to deal with that problem is by creating a loop. You can iterate over the sizes, multiplying each of them by 223, and adding 10,190. However, we are smarter than that, aren’t we? We know some linear algebra already. Let’s explore these two objects: A 5 by 2 matrix and a vector of length 2. The matrix contains a column of 1s and another – with the sizes of the houses. The vector contains 10,190 and 223 – the numbers from the equation. If we go about multiplying them, we will get a vector of length 5. The first element will be equal to: 1 times 10,190 plus 693 times 223. The second to: 1 times 10,190 plus 656 times 223. And so on. ► Consider hitting the SUBSCRIBE button if you LIKE the content: https://www.youtube.com/c/365DataScience?sub_confirmation=1 ► VISIT our
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from 365 Data Science · 365 Data Science · 0 of 60

← Previous Next →
1 Population vs Sample
Population vs Sample
365 Data Science
2 Data Science & Statistics: Levels of measurement
Data Science & Statistics: Levels of measurement
365 Data Science
3 Statistics Tutorials: Mean, median and mode
Statistics Tutorials: Mean, median and mode
365 Data Science
4 Skewness
Skewness
365 Data Science
5 What is a distribution?
What is a distribution?
365 Data Science
6 The Normal Distribution
The Normal Distribution
365 Data Science
7 Central limit theorem
Central limit theorem
365 Data Science
8 Student's T Distribution
Student's T Distribution
365 Data Science
9 Type I error vs Type II error
Type I error vs Type II error
365 Data Science
10 Hypothesis testing. Null vs alternative
Hypothesis testing. Null vs alternative
365 Data Science
11 The linear regression model
The linear regression model
365 Data Science
12 Simple linear regression model. Geometrical representation
Simple linear regression model. Geometrical representation
365 Data Science
13 INDEX and MATCH application of the two functions separately and combined [Advanced Excel]
INDEX and MATCH application of the two functions separately and combined [Advanced Excel]
365 Data Science
14 INDIRECT Excel Function: How it works and when to use it [Advanced Excel]
INDIRECT Excel Function: How it works and when to use it [Advanced Excel]
365 Data Science
15 VLOOKUP and MATCH another useful functions combination [Advanced Excel]
VLOOKUP and MATCH another useful functions combination [Advanced Excel]
365 Data Science
16 VLOOKUP COLUMN and ROW - Handle large data tables with ease [Advanced Excel]
VLOOKUP COLUMN and ROW - Handle large data tables with ease [Advanced Excel]
365 Data Science
17 The ELIF keyword [Python Fundamentals]
The ELIF keyword [Python Fundamentals]
365 Data Science
18 Working with Tuples in Python
Working with Tuples in Python
365 Data Science
19 Database Terminology - A Beginners Guide
Database Terminology - A Beginners Guide
365 Data Science
20 Relational Database Essentials
Relational Database Essentials
365 Data Science
21 Database vs Spreadsheet - Advantages and Disadvantages
Database vs Spreadsheet - Advantages and Disadvantages
365 Data Science
22 Conditional Statements and Loops
Conditional Statements and Loops
365 Data Science
23 Backpropagation – The Math Behind Optimization
Backpropagation – The Math Behind Optimization
365 Data Science
24 Monte Carlo: Forecasting Stock Prices Part I
Monte Carlo: Forecasting Stock Prices Part I
365 Data Science
25 Monte Carlo: Forecasting Stock Prices Part II
Monte Carlo: Forecasting Stock Prices Part II
365 Data Science
26 Monte Carlo: Forecasting Stock Prices Part III
Monte Carlo: Forecasting Stock Prices Part III
365 Data Science
27 365 Data Science Online Program
365 Data Science Online Program
365 Data Science
28 Data frames - Creating a data frame
Data frames - Creating a data frame
365 Data Science
29 Data Science & Statistics: Slicing a matrix in R
Data Science & Statistics: Slicing a matrix in R
365 Data Science
30 Data frames in R - Exporting data in R
Data frames in R - Exporting data in R
365 Data Science
31 Data frames in R - Transforming data PART II
Data frames in R - Transforming data PART II
365 Data Science
32 Data Frames in R - Subsetting a data frame
Data Frames in R - Subsetting a data frame
365 Data Science
33 Data Science & Statistics: Matrix arithmetic in R
Data Science & Statistics: Matrix arithmetic in R
365 Data Science
34 Data Science & Statistics: Indexing an element from a matrix
Data Science & Statistics: Indexing an element from a matrix
365 Data Science
35 Data Frames in R - Extending a data frame
Data Frames in R - Extending a data frame
365 Data Science
36 Data Science & Statistics: Creating a matrix in R FASTER
Data Science & Statistics: Creating a matrix in R FASTER
365 Data Science
37 Data Science & Statistics: Creating a Matrix in R
Data Science & Statistics: Creating a Matrix in R
365 Data Science
38 Data frames - Importing data in R
Data frames - Importing data in R
365 Data Science
39 Data frames in R - Getting a sense of your data
Data frames in R - Getting a sense of your data
365 Data Science
40 Data frames in R - Transforming data PART I
Data frames in R - Transforming data PART I
365 Data Science
41 Data frames in R - Import a CSV in R
Data frames in R - Import a CSV in R
365 Data Science
42 Data Science & Statistics: Matrix operations in R
Data Science & Statistics: Matrix operations in R
365 Data Science
43 Data Science & Statistics: Matrix recycling in R
Data Science & Statistics: Matrix recycling in R
365 Data Science
44 Tableau vs Excel: When to use Tableau and when to use Excel
Tableau vs Excel: When to use Tableau and when to use Excel
365 Data Science
45 Download Tableau: Learn how to download Tableau Public
Download Tableau: Learn how to download Tableau Public
365 Data Science
46 Connecting data sources: Useful tips when connecting data sources to Tableau
Connecting data sources: Useful tips when connecting data sources to Tableau
365 Data Science
47 The Tableau interface: See how to navigate through the Tableau interface
The Tableau interface: See how to navigate through the Tableau interface
365 Data Science
48 Tableau data visualization: Create your first Tableau visualization!
Tableau data visualization: Create your first Tableau visualization!
365 Data Science
49 Duplicating sheets: This is how to duplicate a sheet in Tableau
Duplicating sheets: This is how to duplicate a sheet in Tableau
365 Data Science
50 Build a table in Tableau: The steps needed to create a simple table in Tableau
Build a table in Tableau: The steps needed to create a simple table in Tableau
365 Data Science
51 Custom fields in Tableau: Using Tableau operators to create custom fields
Custom fields in Tableau: Using Tableau operators to create custom fields
365 Data Science
52 Custom fields in Tableau: Add calculations to tables through custom fields
Custom fields in Tableau: Add calculations to tables through custom fields
365 Data Science
53 Totals in Tableau: Learn how to display subtotals and totals in Tableau
Totals in Tableau: Learn how to display subtotals and totals in Tableau
365 Data Science
54 Gross Margin calculation in Tableau
Gross Margin calculation in Tableau
365 Data Science
55 What is a filter in Tableau: Set up a filter in Tableau to specify the data you want to show
What is a filter in Tableau: Set up a filter in Tableau to specify the data you want to show
365 Data Science
56 Joins in Tableau: Inner, outer, left, or a right join in Tableau
Joins in Tableau: Inner, outer, left, or a right join in Tableau
365 Data Science
57 Building a Tableau dashboard: Three types of charts you want to have in a Tableau dashboard
Building a Tableau dashboard: Three types of charts you want to have in a Tableau dashboard
365 Data Science
58 Creating great looking charts in Tableau: Real life Exercise on charts in Tableau
Creating great looking charts in Tableau: Real life Exercise on charts in Tableau
365 Data Science
59 Joins in Tableau: Choose the correct join type
Joins in Tableau: Choose the correct join type
365 Data Science
60 How to make a data check in Tableau: A quick data check is better than no data check
How to make a data check in Tableau: A quick data check is better than no data check
365 Data Science

Linear algebra is a fundamental tool in data science, with applications in machine learning, image recognition, and dimensionality reduction. This video explains how linear algebra can be used to vectorize code, recognize images, and reduce dimensionality.

Key Takeaways
  1. Recognize the importance of linear algebra in data science
  2. Understand how to vectorize code using linear algebra
  3. Apply linear algebra to image recognition tasks
  4. Use dimensionality reduction techniques to simplify complex problems
💡 Linear algebra provides a powerful framework for efficient computation and problem-solving in data science, with applications in machine learning, image recognition, and dimensionality reduction.

Related Reads

Up next
How to Open OSM Files (OpenStreetMap Data)
File Extension Geeks
Watch →