@@ -419,8 +419,7 @@ Basic use
419419This section uses :class: `~dask_ml.model_selection.HyperbandSearchCV `, but it can
420420also be applied to to :class: `~dask_ml.model_selection.IncrementalSearchCV ` too.
421421
422- .. ipython :: python
423- :okwarning:
422+ .. code-block :: python
424423
425424 from dask.distributed import Client
426425 from dask_ml.datasets import make_classification
@@ -432,14 +431,14 @@ also be applied to to :class:`~dask_ml.model_selection.IncrementalSearchCV` too.
432431 Our underlying model is an :class: `sklearn.linear_model.SGDClasifier `. We
433432specify a few parameters common to each clone of the model:
434433
435- .. ipython :: python
434+ .. code-block :: python
436435
437436 from sklearn.linear_model import SGDClassifier
438437 clf = SGDClassifier(tol = 1e-3 , penalty = ' elasticnet' , random_state = 0 )
439438
440439 We also define the distribution of parameters from which we will sample:
441440
442- .. ipython :: python
441+ .. code-block :: python
443442
444443 from scipy.stats import uniform, loguniform
445444 params = {' alpha' : loguniform(1e-2 , 1e0 ), # or np.logspace
@@ -449,7 +448,7 @@ We also define the distribution of parameters from which we will sample:
449448 Finally we create many random models in this parameter space and
450449train-and-score them until we find the best one.
451450
452- .. ipython :: python
451+ .. code-block :: python
453452
454453 from dask_ml.model_selection import HyperbandSearchCV
455454
@@ -465,7 +464,7 @@ larger-than-memory Dask Array, you'll exhaust your machine's memory. If you plan
465464to use post-estimation features like scoring or prediction, we recommend using
466465:class: `dask_ml.wrappers.ParallelPostFit `.
467466
468- .. ipython :: python
467+ .. code-block :: python
469468
470469 from dask_ml.wrappers import ParallelPostFit
471470 params = {' estimator__alpha' : loguniform(1e-2 , 1e0 ),
@@ -523,22 +522,22 @@ Hyperband parameters: rule-of-thumb
523522These fall out pretty naturally once it's known how long to train the best
524523model and very approximately how many parameters to sample:
525524
526- .. ipython :: python
525+ .. code-block :: python
527526
528527 n_examples = 20 * len (X_train) # 20 passes through dataset for best model
529528 n_params = 94 # sample approximately 100 parameters; more than 94 will be sampled
530529
531530 With this, it's easy use a rule-of-thumb to compute the inputs to Hyperband:
532531
533- .. ipython :: python
532+ .. code-block :: python
534533
535534 max_iter = n_params
536535 chunk_size = n_examples // n_params # implicit
537536
538537 Now that we've determined the inputs, let's create our search object and
539538rechunk the Dask array:
540539
541- .. ipython :: python
540+ .. code-block :: python
542541
543542 clf = SGDClassifier(tol = 1e-3 , penalty = ' elasticnet' , random_state = 0 )
544543 params = {' alpha' : loguniform(1e-2 , 1e0 ), # or np.logspace
@@ -567,7 +566,7 @@ rule-of-thumb in the "Notes" section of
567566However, this does not explicitly mention the amount of computation performed
568567-- it's only an approximation. The amount of computation can be viewed like so:
569568
570- .. ipython :: python
569+ .. code-block :: python
571570
572571 search.metadata[" partial_fit_calls" ] # best model will see `max_iter` chunks
573572 search.metadata[" n_models" ] # actual number of parameters to sample
@@ -578,7 +577,7 @@ amount of computation. Let's fit
578577:class: `~dask_ml.model_selection.HyperbandSearchCV ` with these different
579578chunks:
580579
581- .. ipython :: python
580+ .. code-block :: python
582581
583582 search.fit(X_train, y_train, classes = [0 , 1 ]);
584583 search.best_params_
0 commit comments