Skip to content

Commit

Permalink
guide on badges
Browse files Browse the repository at this point in the history
- closes #234
  • Loading branch information
casperdcl committed Jun 3, 2022
1 parent 3eb9571 commit 1d05a52
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions content/docs/command-reference/metrics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ DVC itself does not ascribe any specific meaning for these numbers. Usually they
are produced by the model training or model evaluation code and serve as a way
to compare and pick the best performing experiment.

<admon type="tip">

See
[the guide on metrics badges](/doc/start/data-management/metrics-parameters-plots#badges)
for prettifying a repository's with an automatically updated badge like this:

[![DVC-metrics](https://img.shields.io/badge/dynamic/json?url=https://github.com/iterative/example-get-started/raw/main/evaluation.json&query=avg_prec&label=Average%20Precision&colorA=grey&colorB=F46737)](https://github.com/iterative/example-get-started/raw/main/evaluation.json)

</admon>

## Options

- `-h`, `--help` - prints the usage/help message, and exit.
Expand Down
27 changes: 27 additions & 0 deletions content/docs/start/data-management/metrics-parameters-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,32 @@ file:///Users/dvc/example-get-started/plots.html
> [Git revisions](https://git-scm.com/docs/gitrevisions) (commits, tags, branch
> names) to compare.

## Badges

Since metrics are stored in
[JSON or YAML 1.2 files](/doc/command-reference/metrics#supported-file-formats),
it is easy to parse values for use in other services. One example use case is
adding badges to a
[repository's README](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes).
The format for a [dynamic badge](https://shields.io/#dynamic-badge) is:

```
https://img.shields.io/badge/dynamic/{json,xml}\
?url=https://{github,gitlab}.com/<repo>/raw/<branch>/<metrics_file>\
&query=<...>&label=<...>
```
So a GitHub markdown example for
[iterative/example-get-started@main/evaluation.json](https://github.com/iterative/example-get-started/raw/main/evaluation.json)
would be:
```md
[![DVC-metrics](https://img.shields.io/badge/dynamic/json?url=https://github.com/iterative/example-get-started/raw/main/evaluation.json&query=avg_prec&label=Average%20Precision&colorA=grey&colorB=F46737)](https://github.com/iterative/example-get-started/raw/main/evaluation.json)
```

[![DVC-metrics](https://img.shields.io/badge/dynamic/json?url=https://github.com/iterative/example-get-started/raw/main/evaluation.json&query=avg_prec&label=Average%20Precision&colorA=grey&colorB=F46737)](https://github.com/iterative/example-get-started/raw/main/evaluation.json)

---

On the next page, you can learn advanced ways to track, organize, and compare
more experiment iterations.

0 comments on commit 1d05a52

Please sign in to comment.