|
| 1 | +.. SPDX-FileCopyrightText: 2020 Veit Schiele |
| 2 | +.. |
| 3 | +.. SPDX-License-Identifier: BSD-3-Clause |
| 4 | +
|
| 5 | +Experiments |
| 6 | +=========== |
| 7 | + |
| 8 | +If you now change the parameters in the :file:`params.yaml` file, you can |
| 9 | +compare your current working directory with the last commit (``HEAD``): |
| 10 | + |
| 11 | +.. code-block:: console |
| 12 | +
|
| 13 | + $ uv run dvc params diff |
| 14 | + Path Param HEAD workspace |
| 15 | + params.yaml featurize.max_features 100 200 |
| 16 | + params.yaml featurize.ngrams 1 2 |
| 17 | +
|
| 18 | +.. code-block:: console |
| 19 | +
|
| 20 | + $ uv run dvc metrics diff |
| 21 | + Path Metric HEAD workspace Change |
| 22 | + eval/metrics.json avg_prec.test 0.9014 0.925 0.0236 |
| 23 | + eval/metrics.json avg_prec.train 0.95704 0.97437 0.01733 |
| 24 | + eval/metrics.json roc_auc.test 0.93196 0.94602 0.01406 |
| 25 | + eval/metrics.json roc_auc.train 0.97743 0.98667 0.00924 |
| 26 | +
|
| 27 | +.. code-block:: console |
| 28 | +
|
| 29 | + $ uv run dvc plots diff |
| 30 | + file:///Users/veit/dvc-example/dvc_plots/index.html |
| 31 | +
|
| 32 | +.. raw:: html |
| 33 | + :file: plots-diff.html |
| 34 | + |
| 35 | +``dvc exp`` |
| 36 | +----------- |
| 37 | + |
| 38 | +With `dvc exp <https://dvc.org/doc/command-reference/exp>`_, you can also set |
| 39 | +the parameters in the command line, for example: |
| 40 | + |
| 41 | +.. code-block:: console |
| 42 | +
|
| 43 | + $ uv run dvc exp run \ |
| 44 | + --set-param 'featurize.max_features=200' |
| 45 | +
|
| 46 | +You can also change multiple parameters with a single call: |
| 47 | + |
| 48 | +.. code-block:: console |
| 49 | +
|
| 50 | + $ uv run dvc exp run \ |
| 51 | + -S 'featurize.max_features=200' \ |
| 52 | + -S 'featurize.ngrams=2' |
| 53 | +
|
| 54 | +With ``--queue``, you can also specify multiple values for a parameter: |
| 55 | + |
| 56 | +.. code-block:: console |
| 57 | +
|
| 58 | + $ uv run dvc exp run --queue \ |
| 59 | + -S 'featurize.max_features=200,300,400' \ |
| 60 | + -S 'featurize.ngrams=2,3,4' |
| 61 | + Queueing with overrides '{'params.yaml': ['featurize.max_features=200', 'featurize.ngrams=2']}'. |
| 62 | + Queued experiment 'sober-name' for future execution. |
| 63 | + Queueing with overrides '{'params.yaml': ['featurize.max_features=200', 'featurize.ngrams=3']}'. |
| 64 | + Queued experiment 'erect-loir' for future execution. |
| 65 | + Queueing with overrides '{'params.yaml': ['featurize.max_features=200', 'featurize.ngrams=4']}'. |
| 66 | + Queued experiment 'tonic-hood' for future execution. |
| 67 | + Queueing with overrides '{'params.yaml': ['featurize.max_features=300', 'featurize.ngrams=2']}'. |
| 68 | + ... |
| 69 | +
|
| 70 | +To better identify the experiments, you can also specify ``--name``: |
| 71 | + |
| 72 | +.. code-block:: console |
| 73 | +
|
| 74 | + $ uv run dvc exp run --name 'feature-matrix' --queue \ |
| 75 | + -S 'featurize.max_features=200,300,400' \ |
| 76 | + -S 'featurize.ngrams=2,3,4' |
| 77 | + Queueing with overrides '{'params.yaml': ['featurize.max_features=200', 'featurize.ngrams=2']}'. |
| 78 | + Queued experiment 'feature-matrix-1' for future execution. |
| 79 | + Queueing with overrides '{'params.yaml': ['featurize.max_features=200', 'featurize.ngrams=3']}'. |
| 80 | + Queued experiment 'feature-matrix-2' for future execution. |
| 81 | + ... |
| 82 | +
|
| 83 | +Once you have placed some experiments in the queue, you can run them all with |
| 84 | +the following command: |
| 85 | + |
| 86 | +.. code-block:: console |
| 87 | +
|
| 88 | + $ uv run dvc exp run --run-all |
| 89 | +
|
| 90 | +With the ``job`` flag of ``dvc queue start``, you can also use multiple workers |
| 91 | +for the experiments: |
| 92 | + |
| 93 | +.. code-block:: console |
| 94 | +
|
| 95 | + $ uv run dvc queue start --job 8 |
| 96 | + Started '8' new experiments task queue workers. |
| 97 | +
|
| 98 | +.. seealso:: |
| 99 | + * `Get Started: Experimenting Using Pipelines |
| 100 | + <https://dvc.org/doc/start/experiments/experiment-pipelines>`_ |
| 101 | + * `Running Experiments |
| 102 | + <https://dvc.org/doc/user-guide/experiment-management/running-experiments#the-experiments-queue>`_ |
| 103 | + * `dvc queue <https://dvc.org/doc/command-reference/queue>`_ |
0 commit comments