Skip to content

Commit

Permalink
ref: copy edit dumped exp apply Example
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeorpinel committed Mar 1, 2021
1 parent 77b96f1 commit a0ccd63
Showing 1 changed file with 23 additions and 36 deletions.
59 changes: 23 additions & 36 deletions content/docs/command-reference/exp/apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ the current Git commit.
- `-v`, `--verbose` - displays detailed tracing information from executing the
`dvc pull` command.

## Example: Apply and promote an experiment
## Example: Make an experiment persistent

> This example is based on our
> [Get Started](/doc/tutorials/get-started/experiments), where you can find the
> actual source code. Let's say we have run 3 experiments in our project
> workspace:
> actual source code.
Let's say we have run 3 experiments in our project:

```dvc
$ dvc exp show --include-params=featurize
Expand All @@ -59,50 +60,37 @@ $ dvc exp show --include-params=featurize
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

We now wish to commit the results of experiment `1dad0d2` into our project.
Since `exp-e6c97` has the best `auc`, we may want to commit it into our project
(this is what we call to "make it persistent"):

```dvc
$ dvc exp apply exp-1dad0
Changes for experiment 'exp-1dad0' have been applied to your current workspace.
$ dvc exp apply exp-e6c97
Changes for experiment 'exp-e6c97' have been applied...
```

We can inspect these changes with Git:
We can inspect what changed in the workspace with Git,

```dvc
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
modified: dvc.lock
modified: params.yaml
modified: prc.json
modified: scores.json
$ git diff params.yaml scores.json
diff --git a/params.yaml b/params.yaml
index 4c4d898..faf781a 100644
--- a/params.yaml
+++ b/params.yaml
$ git diff params.yaml
```

```git
@@ -3,7 +3,7 @@ prepare:
seed: 20170428
featurize:
- max_features: 1500
+ max_features: 2000
- max_features: 2000
+ max_features: 1500
ngrams: 2
train:
diff --git a/scores.json b/scores.json
index c995f24..c640c4e 100644
--- a/scores.json
+++ b/scores.json
@@ -1 +1 @@
-{"auc": 0.6131382960762474}
\ No newline at end of file
+{"auc": 0.5775633054725381}
\ No newline at end of file
```

and with DVC:

```
```dvc
$ dvc status
Data and pipelines are up to date.
$ dvc diff
Expand All @@ -111,21 +99,17 @@ Modified:
data/features/test.pkl
data/features/train.pkl
model.pkl
prc.json
scores.json
files summary: 0 added, 0 deleted, 5 modified, 0 not in cache
files summary: 0 added, 0 deleted, 3 modified, 0 not in cache
```

To promote this experiment we simply `git add` and `git commit` the changes:
To finish making this experiment persistent, we commit the changes to the repo:

```dvc
$ git add .
$ git commit -m "promote experiment exp-1dad0"
[master 0412386] promote experiment exp-1dad0
$ git commit -m "persist exp-e6c97"
```

Finally, we can now see that the promoted experiment is the new tip of our
master branch:
We can now see that the experiment is the new tip of our master branch:

```dvc
$ dvc exp show --include-params=featurize
Expand All @@ -136,3 +120,6 @@ $ dvc exp show --include-params=featurize
β”‚ master β”‚ 04:31 PM β”‚ 0.57756 β”‚ 2000 β”‚ 2 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

Note that all the other experiments are based on a previous commit, so
`dvc exp show` won't display them by default (but they're still saved).

0 comments on commit a0ccd63

Please sign in to comment.