From the course: Machine Learning and AI Foundations: Value Estimations

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Think in vectors: How to work with large data sets efficiently

Think in vectors: How to work with large data sets efficiently

From the course: Machine Learning and AI Foundations: Value Estimations

Start my 1-month free trial

Think in vectors: How to work with large data sets efficiently

- [Instructor] In machine learning, we often work with large arrays of data. These arrays are sometimes called vectors for single columns of data, and matrices for larger arrays, because of the linear algebra roots of machine learning. Let's take a look at how to work with vectors in code. Let's open up vectors pt1.py. Here we have a simple array, or vector, representing how many square feet are in some of the different houses in our training dataset. When we train machine learning algorithms, we'll often need to apply the same mathematical operation across every row in our training dataset. For example, let's say we want to multiply each of these square foot measurements by a weight of 0.3. What's the most efficient way to do this? In traditional programming, the standard solution is to loop through the array one row at a time with a for loop, like this. Let's run the code and check the output. To run the code, we'll right-click and choose Run. Here in the console, we can see that it…

Contents