Skip to content

Commit 76e392b

Browse files
committed
Fixed some typos
1 parent 35a5922 commit 76e392b

File tree

10 files changed

+33
-36
lines changed

10 files changed

+33
-36
lines changed

ch02/ch02.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@
13321332
"name": "python",
13331333
"nbconvert_exporter": "python",
13341334
"pygments_lexer": "ipython3",
1335-
"version": "3.9.6"
1335+
"version": "3.8.12"
13361336
}
13371337
},
13381338
"nbformat": 4,

ch03/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- Learning the weights of the logistic cost function
1010
- Converting an Adaline implementation into an algorithm for logistic regression
1111
- Training a logistic regression model with scikit-learn
12-
- Tackling over tting via regularization
12+
- Tackling overfitting via regularization
1313
- Maximum margin classification with support vector machines
1414
- Maximum margin intuition
1515
- Dealing with a nonlinearly separable case using slack variables

ch03/ch03.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@
17891789
"name": "python",
17901790
"nbconvert_exporter": "python",
17911791
"pygments_lexer": "ipython3",
1792-
"version": "3.9.6"
1792+
"version": "3.8.12"
17931793
},
17941794
"toc": {
17951795
"nav_menu": {},

ch04/ch04.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1854,7 +1854,7 @@
18541854
"cell_type": "markdown",
18551855
"metadata": {},
18561856
"source": [
1857-
"# Partitioning a dataset into a seperate training and test set"
1857+
"# Partitioning a dataset into a separate training and test set"
18581858
]
18591859
},
18601860
{
@@ -2837,7 +2837,7 @@
28372837
"name": "python",
28382838
"nbconvert_exporter": "python",
28392839
"pygments_lexer": "ipython3",
2840-
"version": "3.9.6"
2840+
"version": "3.8.12"
28412841
},
28422842
"toc": {
28432843
"nav_menu": {},

ch05/ch05.ipynb

+12-12
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"cell_type": "markdown",
9999
"metadata": {},
100100
"source": [
101-
"- [Unsupervised dimensionality reduction via principal component analysis 128](#Unsupervised-dimensionality-reduction-via-principal-component-analysis-128)\n",
101+
"- [Unsupervised dimensionality reduction via principal component analysis](#Unsupervised-dimensionality-reduction-via-principal-component-analysis)\n",
102102
" - [The main steps behind principal component analysis](#The-main-steps-behind-principal-component-analysis)\n",
103103
" - [Extracting the principal components step-by-step](#Extracting-the-principal-components-step-by-step)\n",
104104
" - [Total and explained variance](#Total-and-explained-variance)\n",
@@ -421,9 +421,9 @@
421421
"\n",
422422
"**Note**\n",
423423
"\n",
424-
"Accidentally, I wrote `X_test_std = sc.fit_transform(X_test)` instead of `X_test_std = sc.transform(X_test)`. In this case, it wouldn't make a big difference since the mean and standard deviation of the test set should be (quite) similar to the training set. However, as remember from Chapter 3, the correct way is to re-use parameters from the training set if we are doing any kind of transformation -- the test set should basically stand for \"new, unseen\" data.\n",
424+
"Accidentally, I wrote `X_test_std = sc.fit_transform(X_test)` instead of `X_test_std = sc.transform(X_test)`. In this case, it wouldn't make a big difference since the mean and standard deviation of the test set should be (quite) similar to the training set. However, as you remember from Chapter 3, the correct way is to re-use parameters from the training set if we are doing any kind of transformation -- the test set should basically stand for \"new, unseen\" data.\n",
425425
"\n",
426-
"My initial typo reflects a common mistake is that some people are *not* re-using these parameters from the model training/building and standardize the new data \"from scratch.\" Here's simple example to explain why this is a problem.\n",
426+
"My initial typo reflects a common mistake which is that some people are *not* re-using these parameters from the model training/building and standardize the new data \"from scratch.\" Here is a simple example to explain why this is a problem.\n",
427427
"\n",
428428
"Let's assume we have a simple training set consisting of 3 examples with 1 feature (let's call this feature \"length\"):\n",
429429
"\n",
@@ -445,17 +445,17 @@
445445
"- new_5: 6 cm -> class ?\n",
446446
"- new_6: 7 cm -> class ?\n",
447447
"\n",
448-
"If we look at the \"unstandardized \"length\" values in our training datast, it is intuitive to say that all of these examples are likely belonging to class_2. However, if we standardize these by re-computing standard deviation and and mean you would get similar values as before in the training set and your classifier would (probably incorrectly) classify examples 4 and 5 as class 2.\n",
448+
"If we look at the \"unstandardized \"length\" values in our training datast, it is intuitive to say that all of these examples are likely belonging to class_2. However, if we standardize these by re-computing standard deviation and mean you would get similar values as before in the training set and your classifier would (probably incorrectly) classify examples 4 and 5 as class_2.\n",
449449
"\n",
450-
"- new_std_4: -1.21 -> class 2\n",
451-
"- new_std_5: 0 -> class 2\n",
452-
"- new_std_6: 1.21 -> class 1\n",
450+
"- new_std_4: -1.21 -> class_2\n",
451+
"- new_std_5: 0 -> class_2\n",
452+
"- new_std_6: 1.21 -> class_1\n",
453453
"\n",
454454
"However, if we use the parameters from your \"training set standardization,\" we'd get the values:\n",
455455
"\n",
456-
"- example5: -18.37 -> class 2\n",
457-
"- example6: -17.15 -> class 2\n",
458-
"- example7: -15.92 -> class 2\n",
456+
"- example5: -18.37 -> class_2\n",
457+
"- example6: -17.15 -> class_2\n",
458+
"- example7: -15.92 -> class_2\n",
459459
"\n",
460460
"The values 5 cm, 6 cm, and 7 cm are much lower than anything we have seen in the training set previously. Thus, it only makes sense that the standardized features of the \"new examples\" are much lower than every standardized feature in the training set.\n",
461461
"\n",
@@ -719,7 +719,7 @@
719719
"source": [
720720
"**NOTE**\n",
721721
"\n",
722-
"The following four code cells has been added in addition to the content to the book, to illustrate how to replicate the results from our own PCA implementation in scikit-learn:"
722+
"The following four code cells have been added in addition to the content to the book, to illustrate how to replicate the results from our own PCA implementation in scikit-learn:"
723723
]
724724
},
725725
{
@@ -1821,7 +1821,7 @@
18211821
"name": "python",
18221822
"nbconvert_exporter": "python",
18231823
"pygments_lexer": "ipython3",
1824-
"version": "3.9.6"
1824+
"version": "3.8.12"
18251825
},
18261826
"toc": {
18271827
"nav_menu": {},

ch06/ch06.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@
18941894
"name": "python",
18951895
"nbconvert_exporter": "python",
18961896
"pygments_lexer": "ipython3",
1897-
"version": "3.9.7"
1897+
"version": "3.8.12"
18981898
},
18991899
"toc": {
19001900
"nav_menu": {},

ch07/ch07.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@
18151815
"cell_type": "markdown",
18161816
"metadata": {},
18171817
"source": [
1818-
"## Using XGboost "
1818+
"## Using XGBoost "
18191819
]
18201820
},
18211821
{
@@ -1950,7 +1950,7 @@
19501950
"name": "python",
19511951
"nbconvert_exporter": "python",
19521952
"pygments_lexer": "ipython3",
1953-
"version": "3.9.7"
1953+
"version": "3.8.12"
19541954
},
19551955
"toc": {
19561956
"nav_menu": {},

ch08/ch08.ipynb

+11-14
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
"The IMDB movie review set can be downloaded from [http://ai.stanford.edu/~amaas/data/sentiment/](http://ai.stanford.edu/~amaas/data/sentiment/).\n",
154154
"After downloading the dataset, decompress the files.\n",
155155
"\n",
156-
"A) If you are working with Linux or MacOS X, open a new terminal windowm `cd` into the download directory and execute \n",
156+
"A) If you are working with Linux or MacOS X, open a new terminal window, `cd` into the download directory and execute \n",
157157
"\n",
158158
"`tar -zxf aclImdb_v1.tar.gz`\n",
159159
"\n",
@@ -522,14 +522,14 @@
522522
"cell_type": "markdown",
523523
"metadata": {},
524524
"source": [
525-
"As we can see from executing the preceding command, the vocabulary is stored in a Python dictionary, which maps the unique words that are mapped to integer indices. Next let us print the feature vectors that we just created:"
525+
"As we can see from executing the preceding command, the vocabulary is stored in a Python dictionary, which maps the unique words to integer indices. Next let us print the feature vectors that we just created:"
526526
]
527527
},
528528
{
529529
"cell_type": "markdown",
530530
"metadata": {},
531531
"source": [
532-
"Each index position in the feature vectors shown here corresponds to the integer values that are stored as dictionary items in the CountVectorizer vocabulary. For example, the rst feature at index position 0 resembles the count of the word and, which only occurs in the last document, and the word is at index position 1 (the 2nd feature in the document vectors) occurs in all three sentences. Those values in the feature vectors are also called the raw term frequencies: *tf (t,d)*—the number of times a term t occurs in a document *d*."
532+
"Each index position in the feature vectors shown here corresponds to the integer values that are stored as dictionary items in the CountVectorizer vocabulary. For example, the first feature at index position 0 resembles the count of the word \"and\", which only occurs in the last document, and the word \"is\" at index position 1 (the 2nd feature in the document vectors) occurs in all three sentences. Those values in the feature vectors are also called the raw term frequencies: *tf (t,d)*—the number of times a term t occurs in a document *d*."
533533
]
534534
},
535535
{
@@ -578,7 +578,7 @@
578578
"cell_type": "markdown",
579579
"metadata": {},
580580
"source": [
581-
"When we are analyzing text data, we often encounter words that occur across multiple documents from both classes. Those frequently occurring words typically don't contain useful or discriminatory information. In this subsection, we will learn about a useful technique called term frequency-inverse document frequency (tf-idf) that can be used to downweight those frequently occurring words in the feature vectors. The tf-idf can be de ned as the product of the term frequency and the inverse document frequency:\n",
581+
"When we are analyzing text data, we often encounter words that occur across multiple documents from both classes. Those frequently occurring words typically don't contain useful or discriminatory information. In this subsection, we will learn about a useful technique called term frequency-inverse document frequency (tf-idf) that can be used to downweigh those frequently occurring words in the feature vectors. The tf-idf can be defined as the product of the term frequency and the inverse document frequency:\n",
582582
"\n",
583583
"$$\\text{tf-idf}(t,d)=\\text{tf (t,d)}\\times \\text{idf}(t,d)$$\n",
584584
"\n",
@@ -621,16 +621,14 @@
621621
"cell_type": "markdown",
622622
"metadata": {},
623623
"source": [
624-
"As we saw in the previous subsection, the word is had the largest term frequency in the 3rd document, being the most frequently occurring word. However, after transforming the same feature vector into tf-idfs, we see that the word is is\n",
625-
"now associated with a relatively small tf-idf (0.45) in document 3 since it is\n",
626-
"also contained in documents 1 and 2 and thus is unlikely to contain any useful, discriminatory information.\n"
624+
"As we saw in the previous subsection, the word \"is\" had the largest term frequency in the 3rd document, being the most frequently occurring word. However, after transforming the same feature vector into tf-idfs, we see that the word \"is\" is now associated with a relatively small tf-idf (0.45) in document 3 since it is also contained in documents 1 and 2 and thus is unlikely to contain any useful, discriminatory information.\n"
627625
]
628626
},
629627
{
630628
"cell_type": "markdown",
631629
"metadata": {},
632630
"source": [
633-
"However, if we'd manually calculated the tf-idfs of the individual terms in our feature vectors, we'd have noticed that the `TfidfTransformer` calculates the tf-idfs slightly differently compared to the standard textbook equations that we de ned earlier. The equations for the idf and tf-idf that were implemented in scikit-learn are:"
631+
"However, if we'd manually calculated the tf-idfs of the individual terms in our feature vectors, we'd have noticed that the `TfidfTransformer` calculates the tf-idfs slightly differently compared to the standard textbook equations that we defined earlier. The equations for the idf and tf-idf that were implemented in scikit-learn are:"
634632
]
635633
},
636634
{
@@ -649,10 +647,9 @@
649647
"\n",
650648
"$$v_{\\text{norm}} = \\frac{v}{||v||_2} = \\frac{v}{\\sqrt{v_{1}^{2} + v_{2}^{2} + \\dots + v_{n}^{2}}} = \\frac{v}{\\big (\\sum_{i=1}^{n} v_{i}^{2}\\big)^\\frac{1}{2}}$$\n",
651649
"\n",
652-
"To make sure that we understand how TfidfTransformer works, let us walk\n",
653-
"through an example and calculate the tf-idf of the word is in the 3rd document.\n",
650+
"To make sure that we understand how `TfidfTransformer` works, let us walk through an example and calculate the tf-idf of the word \"is\" in the 3rd document.\n",
654651
"\n",
655-
"The word is has a term frequency of 3 (tf = 3) in document 3 ($d_3$), and the document frequency of this term is 3 since the term is occurs in all three documents (df = 3). Thus, we can calculate the idf as follows:\n",
652+
"The word \"is\" has a term frequency of 3 (tf = 3) in document 3 ($d_3$), and the document frequency of this term is 3 since the term \"is\" occurs in all three documents (df = 3). Thus, we can calculate the idf as follows:\n",
656653
"\n",
657654
"$$\\text{idf}(\"is\", d_3) = log \\frac{1+3}{1+3} = 0$$\n",
658655
"\n",
@@ -686,7 +683,7 @@
686683
"cell_type": "markdown",
687684
"metadata": {},
688685
"source": [
689-
"If we repeated these calculations for all terms in the 3rd document, we'd obtain the following tf-idf vectors: [3.39, 3.0, 3.39, 1.29, 1.29, 1.29, 2.0 , 1.69, 1.29]. However, we notice that the values in this feature vector are different from the values that we obtained from the TfidfTransformer that we used previously. The nal step that we are missing in this tf-idf calculation is the L2-normalization, which can be applied as follows:"
686+
"If we repeated these calculations for all terms in the 3rd document, we'd obtain the following tf-idf vectors: [3.39, 3.0, 3.39, 1.29, 1.29, 1.29, 2.0 , 1.69, 1.29]. However, we notice that the values in this feature vector are different from the values that we obtained from the `TfidfTransformer` that we used previously. The final step that we are missing in this tf-idf calculation is the L2-normalization, which can be applied as follows:"
690687
]
691688
},
692689
{
@@ -1286,7 +1283,7 @@
12861283
"cell_type": "markdown",
12871284
"metadata": {},
12881285
"source": [
1289-
"As we can see, the result above is consistent with the average score computed the `cross_val_score`."
1286+
"As we can see, the result above is consistent with the average score computed with `cross_val_score`."
12901287
]
12911288
},
12921289
{
@@ -1841,7 +1838,7 @@
18411838
"name": "python",
18421839
"nbconvert_exporter": "python",
18431840
"pygments_lexer": "ipython3",
1844-
"version": "3.9.7"
1841+
"version": "3.8.12"
18451842
},
18461843
"toc": {
18471844
"nav_menu": {},

ch09/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- Solving regression for regression parameters with gradient descent
1414
- Estimating the coefficient of a regression model via scikit-learn
1515
- Fitting a robust regression model using RANSAC
16-
- Evaluating the performance of linear regression modelss)
16+
- Evaluating the performance of linear regression models
1717
- Using regularized methods for regression
1818
- Turning a linear regression model into a curve - polynomial regression
1919
- Modeling nonlinear relationships in the Ames Housing dataset

ch19/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- Dynamic programming using the Bellman equation
2020
- Reinforcement learning algorithms
2121
- Dynamic programming
22-
- Policy evaluation – predicting the value function with dynamic programmin
22+
- Policy evaluation – predicting the value function with dynamic programming
2323
- Improving the policy using the estimated value function
2424
- Policy iteration
2525
- Value iteration

0 commit comments

Comments
 (0)