An example for a deeper understanding —
Let`s assume that we have a large data set, each data item is a list of parameters. In Numpy, we have a two-dimensional array where each row represents a data item and the number of rows is — this is the size of the dataset. Suppose we want to apply some kind of scaling to all of this data, each parameter gets its own scaling factor or, say, each parameter is multiplied by some factor.
Just to be clear, let`s count the calories in foods using macronutrients. Roughly speaking, the caloric portions of food are composed of fat (9 calories per gram), protein (4 cpg), and carbohydrates (4 cpg). Thus, if we list some food items (our data) and for each food item we break down their macronutrients (parameters), then we can then multiply each nutrient by its calorie content (apply scaling) to calculate the calorie breakdown for each item. nutrition.
Thanks to this transformation, we can now compute all kinds of useful information. For example, what is the total number of calories present in any food, or given the breakdown of my lunch, find out how many calories I got from protein, and so on.
Let`s see a naive way to create this calculation with Numpy:
[17 11 19] 3 [20 14 22]
Example 2: two-dimensional array
[[11 22 33] [10 20 30]] 4 [[15 26 37] [14 24 34]]
Example 3: b >
[[4 5] [8 10] [12 15]] [[2 4 6] [5 7 9]] [[5 6 7] [9 10 11]] [[5 6 7] [9 10 11]] [[2 4 6] [8 10 12]]
Building a 2D function -
Broadcast is also often used when displaying an image based on two-dimensional functions. If we want to define a function z = f (x, y).
Black Hat Python, 2nd Edition: Python Programming for Hackers and Pentesters PDF, 2nd Edition. Fully updated for Python 3, the second edition of this worldwide bestseller (over 100,000 copies sold)...
Big data is, admittedly, an overhyped buzzword used by software and hardware companies to boost their sales. Behind the hype, however, there is a real and extremely important technology trend with imp...
This book project was first presented to me during my first week in my current role of managing the data mining development at SAS. Writ- ing a book has always been a bucket‐list item, and I was ver...
Data and storage models are the basis for big data ecosystem stacks. While storage model captures the physical aspects and features for data storage, data model captures the logical representation and...