You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Python/Module3_IntroducingNumpy/Broadcasting.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -296,7 +296,7 @@ Generate a random array of 10,000 2D points using `np.random.rand`. Compute the
296
296
### Inserting Size-1 Dimensions into An Array
297
297
As conveyed by the broadcasting rules, dimensions of size-1 are special in that they can be broadcasted to any size. Here we will learn about introducing size-1 dimensions into an array, for the purpose of tailoring its shape for broadcasting.
298
298
299
-
You can introduce size-1 dimensions to an array without changing the overall size (i.e. total number of entries in an array. Thus we are free to add size-1 dimensions to an array via the `reshape` function. Let's reshape a shape-(3,) array into a shape-(1, 3, 1, 1) array:
299
+
You can introduce size-1 dimensions to an array without changing the overall size (i.e. total number of entries in an array). Thus we are free to add size-1 dimensions to an array via the `reshape` function. Let's reshape a shape-(3,) array into a shape-(1, 3, 1, 1) array:
### Pairwise Distances Using Broadcasting (Unoptimized)
531
-
Now, let's use of vectorization to perform this distance computation. It must be established immediately that the method that we about to develop here is memory-inefficient. We will address this issue in detail at the end of this subsection.
531
+
Now, let's make use of vectorization to perform this distance computation. It must be established immediately that the method that we are about to develop here is memory-inefficient. We will address this issue in detail at the end of this subsection.
532
532
533
533
We start off our vectorized computation by shrewdly inserting size-1 dimensions into `x` and `y`, so that we can perform $M \times N$ subtractions between their pairs of length-$D$ rows. *This creates a shape-*$(M, N, D)$ *array*.
534
534
@@ -652,7 +652,7 @@ In terms of pure mathematics, `x_y_sqrd - x_y_prod` must be a strictly non-negat
652
652
\sum_{i=0}^{D-1}{(x_{i} - y_{i})^2}
653
653
\end{equation}
654
654
655
-
That being said, are working with floating-point numbers, which do not always behave exactly like rational numbers when we do arithmetic with them.
655
+
That being said, we are working with floating-point numbers, which do not always behave exactly like rational numbers when we do arithmetic with them.
656
656
Indeed, we saw earlier that the [quirks of floating-point arithmetic](https://www.pythonlikeyoumeanit.com/Module2_EssentialsOfPython/Basic_Objects.html#Understanding-Numerical-Precision) can lead to surprising results.
657
657
Here, the strange behavior is that `x_y_sqrd - x_y_prod`**can produce negative numbers**!
Copy file name to clipboardexpand all lines: Python/Module4_OOP/Applications_of_OOP.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Let's create a shopping list class, where an instance of this class stores a lis
30
30
- mark items on the list as "purchased"
31
31
- remove items, purchased or not, from the list
32
32
- list the name of the items to-be purchased (in alphabetical order)
33
-
- list the name of the items have been purchased (in alphabetical order)
33
+
- list the name of the items that have been purchased (in alphabetical order)
34
34
35
35
We do not want redundant items to be included on our shopping list - if someone enters "apples" twice, we should only list it once. Thus we will make use of [sets](http://www.pythonlikeyoumeanit.com/Module2_EssentialsOfPython/DataStructures_III_Sets_and_More.html#The-%E2%80%9CSet%E2%80%9D-Data-Structure), which store unique elements, to store the items on our list.
Copy file name to clipboardexpand all lines: Python/Module4_OOP/ClassDefinition.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ jupyter:
22
22
<!-- #region -->
23
23
# Defining a New Class of Object
24
24
25
-
This section will introduce the basic syntax for defining a new class (a.k.a. type) of Python object. Recall that the phrase`def` is used to denote the definition of a function. Similarly, `class` is used to denote the beginning of a class definition. The body of the class definition, which is the indented region below a `class` statement, is used to define the class' various **attributes**.
25
+
This section will introduce the basic syntax for defining a new class (a.k.a. type) of Python object. Recall that the statement`def` is used to denote the definition of a function. Similarly, `class` is used to denote the beginning of a class definition. The body of the class definition, which is the indented region below a `class` statement, is used to define the class' various **attributes**.
26
26
27
27
The following defines a new class of object, named `MyGuy`, specifying four attributes `x`, `y`, `z`, and `f`
0 commit comments