Skip to content

Commit c10b50c

Browse files
remove argument equals whitespace: classification2
1 parent 83bd551 commit c10b50c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

source/classification2.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ we call the `seed` function from the `numpy` package, and pass it any integer as
280280
Below we use the seed number `1`. At
281281
that point, Python will keep track of the randomness that occurs throughout the code.
282282
For example, we can call the `sample` method
283-
on the series of numbers, passing the argument `n = 10` to indicate that we want 10 samples.
283+
on the series of numbers, passing the argument `n=10` to indicate that we want 10 samples.
284284

285285
```{code-cell} ipython3
286286
import numpy as np
@@ -290,7 +290,7 @@ np.random.seed(1)
290290
291291
nums_0_to_9 = pd.Series([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
292292
293-
random_numbers1 = nums_0_to_9.sample(n = 10).to_numpy()
293+
random_numbers1 = nums_0_to_9.sample(n=10).to_numpy()
294294
random_numbers1
295295
```
296296
You can see that `random_numbers1` is a list of 10 numbers
@@ -299,7 +299,7 @@ we run the `sample` method again,
299299
we will get a fresh batch of 10 numbers that also look random.
300300

301301
```{code-cell} ipython3
302-
random_numbers2 = nums_0_to_9.sample(n = 10).to_numpy()
302+
random_numbers2 = nums_0_to_9.sample(n=10).to_numpy()
303303
random_numbers2
304304
```
305305

@@ -309,12 +309,12 @@ as before---and then call the `sample` method again.
309309

310310
```{code-cell} ipython3
311311
np.random.seed(1)
312-
random_numbers1_again = nums_0_to_9.sample(n = 10).to_numpy()
312+
random_numbers1_again = nums_0_to_9.sample(n=10).to_numpy()
313313
random_numbers1_again
314314
```
315315

316316
```{code-cell} ipython3
317-
random_numbers2_again = nums_0_to_9.sample(n = 10).to_numpy()
317+
random_numbers2_again = nums_0_to_9.sample(n=10).to_numpy()
318318
random_numbers2_again
319319
```
320320

@@ -326,12 +326,12 @@ obtain a different sequence of random numbers.
326326

327327
```{code-cell} ipython3
328328
np.random.seed(4235)
329-
random_numbers = nums_0_to_9.sample(n = 10).to_numpy()
329+
random_numbers = nums_0_to_9.sample(n=10).to_numpy()
330330
random_numbers
331331
```
332332

333333
```{code-cell} ipython3
334-
random_numbers = nums_0_to_9.sample(n = 10).to_numpy()
334+
random_numbers = nums_0_to_9.sample(n=10).to_numpy()
335335
random_numbers
336336
```
337337

@@ -378,15 +378,15 @@ functions. Those functions will then use your `RandomState` to generate random n
378378
`numpy`'s default generator. For example, we can reproduce our earlier example by using a `RandomState`
379379
object with the `seed` value set to 1; we get the same lists of numbers once again.
380380
```{code}
381-
rnd = np.random.RandomState(seed = 1)
382-
random_numbers1_third = nums_0_to_9.sample(n = 10, random_state = rnd).to_numpy()
381+
rnd = np.random.RandomState(seed=1)
382+
random_numbers1_third = nums_0_to_9.sample(n=10, random_state=rnd).to_numpy()
383383
random_numbers1_third
384384
```
385385
```{code}
386386
array([2, 9, 6, 4, 0, 3, 1, 7, 8, 5])
387387
```
388388
```{code}
389-
random_numbers2_third = nums_0_to_9.sample(n = 10, random_state = rnd).to_numpy()
389+
random_numbers2_third = nums_0_to_9.sample(n=10, random_state=rnd).to_numpy()
390390
random_numbers2_third
391391
```
392392
```{code}
@@ -540,8 +540,8 @@ cancer_train["Class"].value_counts(normalize=True)
540540
```{code-cell} ipython3
541541
:tags: [remove-cell]
542542
543-
glue("cancer_train_b_prop", "{:0.0f}".format(cancer_train["Class"].value_counts(normalize = True)["Benign"]*100))
544-
glue("cancer_train_m_prop", "{:0.0f}".format(cancer_train["Class"].value_counts(normalize = True)["Malignant"]*100))
543+
glue("cancer_train_b_prop", "{:0.0f}".format(cancer_train["Class"].value_counts(normalize=True)["Benign"]*100))
544+
glue("cancer_train_m_prop", "{:0.0f}".format(cancer_train["Class"].value_counts(normalize=True)["Malignant"]*100))
545545
```
546546

547547
### Preprocess the data
@@ -1620,7 +1620,7 @@ for i in range(len(ks)):
16201620
cancer_tune_pipe = make_pipeline(cancer_preprocessor, KNeighborsClassifier())
16211621
param_grid = {
16221622
"kneighborsclassifier__n_neighbors": range(1, 21),
1623-
} ## double check: in R textbook, it is tune_grid(..., grid = 20), so I guess it matches RandomizedSearchCV
1623+
} ## double check: in R textbook, it is tune_grid(..., grid=20), so I guess it matches RandomizedSearchCV
16241624
## instead of GridSeachCV?
16251625
# param_grid_rand = {
16261626
# "kneighborsclassifier__n_neighbors": range(1, 100),

0 commit comments

Comments
 (0)