Skip to content

Commit 1d24bb0

Browse files
authored
Minor fixes to docs (#473)
Fix cross-references to dask.delayed.delayed. Remove Oxford comma before "or" when listing possible types for arguments. It made the "or" word to be treated as a possible type instead of the connector.
1 parent 45e3df0 commit 1d24bb0

6 files changed

Lines changed: 31 additions & 30 deletions

File tree

doc/tutorials_src/model_evaluation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
# In this case, the scores haven't actually been computed yet (hence the
211211
# "delayed" term). Instead, Verde scheduled the operations with Dask. Since we
212212
# are interested only in the mean score, we can schedule the mean as well using
213-
# :func:`dask.delayed`:
213+
# :func:`dask.delayed.delayed`:
214214

215215
mean_score = dask.delayed(np.mean)(scores)
216216
print("Delayed mean:", mean_score)

doc/tutorials_src/model_selection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,17 @@
140140

141141
###############################################################################
142142
# Unlike :func:`verde.cross_val_score`, calling :meth:`~verde.SplineCV.fit`
143-
# does **not** result in :func:`dask.delayed` objects. The full grid search is
144-
# executed and the optimal parameters are found immediately.
143+
# does **not** result in :func:`dask.delayed.delayed` objects. The full grid
144+
# search is executed and the optimal parameters are found immediately.
145145

146146
spline.fit(proj_coords, data.air_temperature_c)
147147

148148
print("Best damping:", spline.damping_)
149149

150150
###############################################################################
151151
# The one caveat is the that the ``scores_`` attribute will be a list of
152-
# :func:`dask.delayed` objects instead because the scores are only computed as
153-
# intermediate values in the scheduled computations.
152+
# :func:`dask.delayed.delayed` objects instead because the scores are only
153+
# computed as intermediate values in the scheduled computations.
154154

155155
print("Delayed scores:", spline.scores_)
156156

verde/coordinates.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def scatter_points(region, size, random_state=None, extra_coords=None):
135135
permutations. Use a fixed seed to make sure computations are
136136
reproducible. Use ``None`` to choose a seed automatically (resulting in
137137
different numbers with each run).
138-
extra_coords : None, scalar, or list
138+
extra_coords : None, scalar or list
139139
If not None, then value(s) of extra coordinate arrays to be generated.
140140
These extra arrays will have the same *size* as the others but will
141141
contain a constant value. Will generate an extra array per value given
@@ -331,7 +331,7 @@ def grid_coordinates(
331331
instead of the grid lines. In practice, this means that there will be
332332
one less element per dimension of the grid when compared to grid line
333333
registered (only if given *spacing* and not *shape*). Default is False.
334-
extra_coords : None, scalar, or list
334+
extra_coords : None, scalar or list
335335
If not None, then value(s) of extra coordinate arrays to be generated.
336336
These extra arrays will have the same *shape* as the others but will
337337
contain a constant value. Will generate an extra array per value given
@@ -709,7 +709,7 @@ def profile_coordinates(point1, point2, size, extra_coords=None):
709709
second point, respectively.
710710
size : int
711711
Number of points to sample along the line.
712-
extra_coords : None, scalar, or list
712+
extra_coords : None, scalar or list
713713
If not None, then value(s) of extra coordinate arrays to be generated.
714714
These extra arrays will have the same *size* as the others but will
715715
contain a constant value. Will generate an extra array per value given

verde/model_selection.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class BlockShuffleSplit(BaseBlockCrossValidator):
7070
absolute number of test samples. If None, the value is set to the
7171
complement of the train size. If ``train_size`` is also None, it will
7272
be set to 0.1.
73-
train_size : float, int, or None, default=None
73+
train_size : float, int or None, default=None
7474
If float, should be between 0.0 and 1.0 and represent the
7575
proportion of the dataset to include in the train split. If
7676
int, represents the absolute number of train samples. If None,
@@ -605,11 +605,11 @@ def cross_val_score(
605605
scoring function (e.g., mean square error, mean absolute error, etc).
606606
607607
Can optionally run in parallel using :mod:`dask`. To do this, use
608-
``delayed=True`` to dispatch computations with :func:`dask.delayed` instead
609-
of running them. The returned scores will be "lazy" objects instead of the
610-
actual scores. To trigger the computation (which Dask will run in parallel)
611-
call the `.compute()` method of each score or :func:`dask.compute` with the
612-
entire list of scores.
608+
``delayed=True`` to dispatch computations with :func:`dask.delayed.delayed`
609+
instead of running them. The returned scores will be "lazy" objects instead
610+
of the actual scores. To trigger the computation (which Dask will run in
611+
parallel) call the `.compute()` method of each score or
612+
:func:`dask.compute` with the entire list of scores.
613613
614614
.. warning::
615615
@@ -639,11 +639,12 @@ def cross_val_score(
639639
be a dask ``Client`` object. It will be used to dispatch computations
640640
to the dask cluster.
641641
delayed : bool
642-
If True, will use :func:`dask.delayed` to dispatch computations without
643-
actually executing them. The returned scores will be a list of delayed
644-
objects. Call `.compute()` on each score or :func:`dask.compute` on the
645-
entire list to trigger the actual computations.
646-
scoring : None, str, or callable
642+
If True, will use :func:`dask.delayed.delayed` to dispatch computations
643+
without actually executing them. The returned scores will be a list of
644+
delayed objects. Call `.compute()` on each score or
645+
:func:`dask.compute` on the entire list to trigger the actual
646+
computations.
647+
scoring : None, str or callable
647648
A scoring function (or name of a function) known to scikit-learn. See
648649
the description of *scoring* in
649650
:func:`sklearn.model_selection.cross_val_score` for details. If None,

verde/spline.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ class SplineCV(BaseGridder):
3636
(or minimum) mean cross-validation score (i.e., a grid search).
3737
3838
This can optionally run in parallel using :mod:`dask`. To do this, use
39-
``delayed=True`` to dispatch computations with :func:`dask.delayed`.
40-
In this case, each fit and score operation of the grid search will be
41-
performed in parallel.
39+
``delayed=True`` to dispatch computations with
40+
:func:`dask.delayed.delayed`. In this case, each fit and score
41+
operation of the grid search will be performed in parallel.
4242
4343
.. note::
4444
4545
When using *delayed*, the ``scores_`` attribute will be
46-
:func:`dask.delayed` objects instead of the actual scores. This is
47-
because the scores are an intermediate step in the computations and
46+
:func:`dask.delayed.delayed` objects instead of the actual scores. This
47+
is because the scores are an intermediate step in the computations and
4848
their results are not stored. If you need the scores, run
4949
:func:`dask.compute` on ``scores_`` to calculate them. Be warned that
5050
**this will run the grid search again**. It might still be faster than
@@ -91,10 +91,10 @@ class SplineCV(BaseGridder):
9191
be a dask ``Client`` object. It will be used to dispatch computations
9292
to the dask cluster.
9393
delayed : bool
94-
If True, will use :func:`dask.delayed` to dispatch computations and
95-
allow mod:`dask` to execute the grid search in parallel (see note
94+
If True, will use :func:`dask.delayed.delayed` to dispatch computations
95+
and allow mod:`dask` to execute the grid search in parallel (see note
9696
above).
97-
scoring : None, str, or callable
97+
scoring : None, str or callable
9898
The scoring function (or name of a function) used for cross-validation.
9999
Must be known to scikit-learn. See the description of *scoring* in
100100
:func:`sklearn.model_selection.cross_val_score` for details. If None,
@@ -115,8 +115,8 @@ class SplineCV(BaseGridder):
115115
methods.
116116
scores_ : array
117117
The mean cross-validation score for each parameter combination. If
118-
``delayed=True``, will be a list of :func:`dask.delayed` objects (see
119-
note above).
118+
``delayed=True``, will be a list of :func:`dask.delayed.delayed`
119+
objects (see note above).
120120
mindist_ : float
121121
The optimal value for the *mindist* parameter.
122122
damping_ : float

verde/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def dispatch(function, delayed=False, client=None):
4343
function : callable
4444
The function that will be called.
4545
delayed : bool
46-
If True, will wrap the function in :func:`dask.delayed`.
46+
If True, will wrap the function in :func:`dask.delayed.delayed`.
4747
client : None or dask.distributed Client
4848
If *delayed* is False and *client* is not None, will return a partial
4949
execution of the ``client.submit`` with the function as first argument.

0 commit comments

Comments
 (0)