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: Ch04-classification-lab.Rmd
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -405,7 +405,7 @@ lda.fit(X_train, L_train)
405
405
406
406
```
407
407
Here we have used the list comprehensions introduced
408
-
in Section~\ref{Ch3-linreg-lab:multivariate-goodness-of-fit}. Looking at our first line above, we see that the right-hand side is a list
408
+
in Section 3.6.4. Looking at our first line above, we see that the right-hand side is a list
409
409
of length two. This is because the code `for M in [X_train, X_test]` iterates over a list
410
410
of length two. While here we loop over a list,
411
411
the list comprehension method works when looping over any iterable object.
@@ -454,7 +454,7 @@ lda.scalings_
454
454
455
455
```
456
456
457
-
These values provide the linear combination of `Lag1` and `Lag2` that are used to form the LDA decision rule. In other words, these are the multipliers of the elements of $X=x$ in (\ref{Ch4:bayes.multi}).
457
+
These values provide the linear combination of `Lag1` and `Lag2` that are used to form the LDA decision rule. In other words, these are the multipliers of the elements of $X=x$ in (4.24).
458
458
If $-0.64\times `Lag1` - 0.51 \times `Lag2` $ is large, then the LDA classifier will predict a market increase, and if it is small, then the LDA classifier will predict a market decline.
As we observed in our comparison of classification methods
466
-
(Section~\ref{Ch4:comparison.sec}), the LDA and logistic
466
+
(Section 4.5), the LDA and logistic
467
467
regression predictions are almost identical.
468
468
469
469
```{python}
@@ -522,7 +522,7 @@ The LDA classifier above is the first classifier from the
522
522
`sklearn` library. We will use several other objects
523
523
from this library. The objects
524
524
follow a common structure that simplifies tasks such as cross-validation,
525
-
which we will see in Chapter~\ref{Ch5:resample}. Specifically,
525
+
which we will see in Chapter 5. Specifically,
526
526
the methods first create a generic classifier without
527
527
referring to any data. This classifier is then fit
528
528
to data with the `fit()` method and predictions are
@@ -808,7 +808,7 @@ feature_std.std()
808
808
809
809
```
810
810
811
-
Notice that the standard deviations are not quite $1$ here; this is again due to some procedures using the $1/n$ convention for variances (in this case `scaler()`), while others use $1/(n-1)$ (the `std()` method). See the footnote on page~\pageref{Ch4-varformula}.
811
+
Notice that the standard deviations are not quite $1$ here; this is again due to some procedures using the $1/n$ convention for variances (in this case `scaler()`), while others use $1/(n-1)$ (the `std()` method). See the footnote on page 183.
812
812
In this case it does not matter, as long as the variables are all on the same scale.
813
813
814
814
Using the function `train_test_split()` we now split the observations into a test set,
@@ -875,7 +875,7 @@ This is double the rate that one would obtain from random guessing.
875
875
The number of neighbors in KNN is referred to as a *tuning parameter*, also referred to as a *hyperparameter*.
876
876
We do not know *a priori* what value to use. It is therefore of interest
877
877
to see how the classifier performs on test data as we vary these
878
-
parameters. This can be achieved with a `for` loop, described in Section~\ref{Ch2-statlearn-lab:for-loops}.
878
+
parameters. This can be achieved with a `for` loop, described in Section 2.3.8.
879
879
Here we use a for loop to look at the accuracy of our classifier in the group predicted to purchase
880
880
insurance as we vary the number of neighbors from 1 to 5:
881
881
@@ -902,7 +902,7 @@ As a comparison, we can also fit a logistic regression model to the
902
902
data. This can also be done
903
903
with `sklearn`, though by default it fits
904
904
something like the *ridge regression* version
905
-
of logistic regression, which we introduce in Chapter~\ref{Ch6:varselect}. This can
905
+
of logistic regression, which we introduce in Chapter 6. This can
906
906
be modified by appropriately setting the argument `C` below. Its default
907
907
value is 1 but by setting it to a very large number, the algorithm converges to the same solution as the usual (unregularized)
We can plot the coefficients associated with `mnth` and `hr`, in order to reproduce Figure~\ref{Ch4:bikeshare.pois}. We first complete these coefficients as before.
1119
+
We can plot the coefficients associated with `mnth` and `hr`, in order to reproduce Figure 4.15. We first complete these coefficients as before.
Copy file name to clipboardExpand all lines: Ch04-classification-lab.ipynb
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -2007,7 +2007,7 @@
2007
2007
"metadata": {},
2008
2008
"source": [
2009
2009
"Here we have used the list comprehensions introduced\n",
2010
-
"in Section~\\ref{Ch3-linreg-lab:multivariate-goodness-of-fit}. Looking at our first line above, we see that the right-hand side is a list\n",
2010
+
"in Section 3.6.4. Looking at our first line above, we see that the right-hand side is a list\n",
2011
2011
"of length two. This is because the code `for M in [X_train, X_test]` iterates over a list\n",
2012
2012
"of length two. While here we loop over a list,\n",
2013
2013
"the list comprehension method works when looping over any iterable object.\n",
@@ -2173,7 +2173,7 @@
2173
2173
"id": "f0a4abaf",
2174
2174
"metadata": {},
2175
2175
"source": [
2176
-
"These values provide the linear combination of `Lag1` and `Lag2` that are used to form the LDA decision rule. In other words, these are the multipliers of the elements of $X=x$ in (\\ref{Ch4:bayes.multi}).\n",
2176
+
"These values provide the linear combination of `Lag1` and `Lag2` that are used to form the LDA decision rule. In other words, these are the multipliers of the elements of $X=x$ in (4.24).\n",
2177
2177
" If $-0.64\\times `Lag1` - 0.51 \\times `Lag2` $ is large, then the LDA classifier will predict a market increase, and if it is small, then the LDA classifier will predict a market decline."
2178
2178
]
2179
2179
},
@@ -2200,7 +2200,7 @@
2200
2200
"metadata": {},
2201
2201
"source": [
2202
2202
"As we observed in our comparison of classification methods\n",
2203
-
" (Section~\\ref{Ch4:comparison.sec}), the LDA and logistic\n",
2203
+
" (Section 4.5), the LDA and logistic\n",
2204
2204
"regression predictions are almost identical."
2205
2205
]
2206
2206
},
@@ -2421,7 +2421,7 @@
2421
2421
"`sklearn` library. We will use several other objects\n",
2422
2422
"from this library. The objects\n",
2423
2423
"follow a common structure that simplifies tasks such as cross-validation,\n",
2424
-
"which we will see in Chapter~\\ref{Ch5:resample}. Specifically,\n",
2424
+
"which we will see in Chapter 5. Specifically,\n",
2425
2425
"the methods first create a generic classifier without\n",
2426
2426
"referring to any data. This classifier is then fit\n",
2427
2427
"to data with the `fit()` method and predictions are\n",
@@ -4349,7 +4349,7 @@
4349
4349
"id": "c225f2b2",
4350
4350
"metadata": {},
4351
4351
"source": [
4352
-
"Notice that the standard deviations are not quite $1$ here; this is again due to some procedures using the $1/n$ convention for variances (in this case `scaler()`), while others use $1/(n-1)$ (the `std()` method). See the footnote on page~\\pageref{Ch4-varformula}.\n",
4352
+
"Notice that the standard deviations are not quite $1$ here; this is again due to some procedures using the $1/n$ convention for variances (in this case `scaler()`), while others use $1/(n-1)$ (the `std()` method). See the footnote on page 183.\n",
4353
4353
"In this case it does not matter, as long as the variables are all on the same scale.\n",
4354
4354
"\n",
4355
4355
"Using the function `train_test_split()` we now split the observations into a test set,\n",
@@ -4570,7 +4570,7 @@
4570
4570
"The number of neighbors in KNN is referred to as a *tuning parameter*, also referred to as a *hyperparameter*.\n",
4571
4571
"We do not know *a priori* what value to use. It is therefore of interest\n",
4572
4572
"to see how the classifier performs on test data as we vary these\n",
4573
-
"parameters. This can be achieved with a `for` loop, described in Section~\\ref{Ch2-statlearn-lab:for-loops}.\n",
4573
+
"parameters. This can be achieved with a `for` loop, described in Section 2.3.8.\n",
4574
4574
"Here we use a for loop to look at the accuracy of our classifier in the group predicted to purchase\n",
4575
4575
"insurance as we vary the number of neighbors from 1 to 5:"
4576
4576
]
@@ -4629,7 +4629,7 @@
4629
4629
"data. This can also be done\n",
4630
4630
"with `sklearn`, though by default it fits\n",
4631
4631
"something like the *ridge regression* version\n",
4632
-
"of logistic regression, which we introduce in Chapter~\\ref{Ch6:varselect}. This can\n",
4632
+
"of logistic regression, which we introduce in Chapter 6. This can\n",
4633
4633
"be modified by appropriately setting the argument `C` below. Its default\n",
4634
4634
"value is 1 but by setting it to a very large number, the algorithm converges to the same solution as the usual (unregularized)\n",
"## Linear and Poisson Regression on the Bikeshare Data\n",
4852
-
"Here we fit linear and Poisson regression models to the `Bikeshare` data, as described in Section~\\ref{Ch4:sec:pois}.\n",
4852
+
"Here we fit linear and Poisson regression models to the `Bikeshare` data, as described in Section 4.6.\n",
4853
4853
"The response `bikers` measures the number of bike rentals per hour\n",
4854
4854
"in Washington, DC in the period 2010--2012."
4855
4855
]
@@ -5322,7 +5322,7 @@
5322
5322
"February than in January. Similarly there are about 16.5 more riders\n",
5323
5323
"in March than in January.\n",
5324
5324
"\n",
5325
-
"The results seen in Section~\\ref{sec:bikeshare.linear}\n",
5325
+
"The results seen in Section 4.6.1\n",
5326
5326
"used a slightly different coding of the variables `hr` and `mnth`, as follows:"
5327
5327
]
5328
5328
},
@@ -5834,7 +5834,7 @@
5834
5834
"id": "41fb2787",
5835
5835
"metadata": {},
5836
5836
"source": [
5837
-
"To reproduce the left-hand side of Figure~\\ref{Ch4:bikeshare}\n",
5837
+
"To reproduce the left-hand side of Figure 4.13\n",
5838
5838
"we must first obtain the coefficient estimates associated with\n",
5839
5839
"`mnth`. The coefficients for January through November can be obtained\n",
5840
5840
"directly from the `M2_lm` object. The coefficient for December\n",
@@ -5988,7 +5988,7 @@
5988
5988
"id": "6c68761a",
5989
5989
"metadata": {},
5990
5990
"source": [
5991
-
"Reproducing the right-hand plot in Figure~\\ref{Ch4:bikeshare} follows a similar process."
5991
+
"Reproducing the right-hand plot in Figure 4.13 follows a similar process."
5992
5992
]
5993
5993
},
5994
5994
{
@@ -6088,7 +6088,7 @@
6088
6088
"id": "8552fb8b",
6089
6089
"metadata": {},
6090
6090
"source": [
6091
-
"We can plot the coefficients associated with `mnth` and `hr`, in order to reproduce Figure~\\ref{Ch4:bikeshare.pois}. We first complete these coefficients as before."
6091
+
"We can plot the coefficients associated with `mnth` and `hr`, in order to reproduce Figure 4.15. We first complete these coefficients as before."
0 commit comments