Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exp show: Add --drop and --keep args #7141

Merged
merged 2 commits into from
Jan 20, 2022
Merged

exp show: Add --drop and --keep args #7141

merged 2 commits into from
Jan 20, 2022

Conversation

daavoo
Copy link
Contributor

@daavoo daavoo commented Dec 13, 2021


  • Removed --include-metrics / --include-params and
    --exclude-metrics / --exclude-params.

  • Removed --no-timestamp (-> --drop Created)

  • --drop and --keep operate directly on the table columns.
    Support regex patterns.

  • --keep does not perform any filtering.
    It's only used to specify columns to keep despite the other filtering.
    Previous --include behavior can be replicated with negative lookahead regex.

Closes #7079
Closes #7080
Closes #7083
Pre-requisite for #6434


Example:

`dvc exp show`
| Experiment              | Created      | loss    | accuracy   | train.batch_size   | train.hidden_units   | train.dropout   | train.num_epochs   | train.lr   | train.conv_activation   |
|-------------------------|--------------|---------|------------|--------------------|----------------------|-----------------|--------------------|------------|-------------------------|
| workspace               | -            | 0.31941 | 0.8997     | 128                | 64                   | 0.3             | 10                 | 0.01       | relu                    |
| main                    | Sep 14, 2021 | 0.26484 | 0.9038     | 128                | 64                   | 0.4             | 10                 | 0.001      | relu                    |
| β”œβ”€β”€ d599d35 [exp-4f1f0] | 06:12 PM     | 0.31941 | 0.8997     | 128                | 64                   | 0.3             | 10                 | 0.01       | relu                    |
| β”œβ”€β”€ c6d3ac6 [exp-eec4c] | 06:10 PM     | 0.24435 | 0.9135     | 128                | 64                   | 0.3             | 10                 | 0.001      | relu                    |
| └── 0d5e1ae [exp-25fae] | 06:03 PM     | 0.26133 | 0.9062     | 128                | 64                   | 0.4             | 10                 | 0.001      | relu                    |
`dvc exp show --only-changed`
| Experiment              | Created      | loss    | accuracy   | train.dropout   | train.lr   |
|-------------------------|--------------|---------|------------|-----------------|------------|
| workspace               | -            | 0.31941 | 0.8997     | 0.3             | 0.01       |
| main                    | Sep 14, 2021 | 0.26484 | 0.9038     | 0.4             | 0.001      |
| β”œβ”€β”€ d599d35 [exp-4f1f0] | 06:12 PM     | 0.31941 | 0.8997     | 0.3             | 0.01       |
| β”œβ”€β”€ c6d3ac6 [exp-eec4c] | 06:10 PM     | 0.24435 | 0.9135     | 0.3             | 0.001      |
| └── 0d5e1ae [exp-25fae] | 06:03 PM     | 0.26133 | 0.9062     | 0.4             | 0.001      |
`dvc exp show --only-changed --keep train.batch_size`
| Experiment              | Created      | loss    | accuracy   | train.batch_size   | train.dropout   | train.lr   |
|-------------------------|--------------|---------|------------|--------------------|-----------------|------------|
| workspace               | -            | 0.31941 | 0.8997     | 128                | 0.3             | 0.01       |
| main                    | Sep 14, 2021 | 0.26484 | 0.9038     | 128                | 0.4             | 0.001      |
| β”œβ”€β”€ d599d35 [exp-4f1f0] | 06:12 PM     | 0.31941 | 0.8997     | 128                | 0.3             | 0.01       |
| β”œβ”€β”€ c6d3ac6 [exp-eec4c] | 06:10 PM     | 0.24435 | 0.9135     | 128                | 0.3             | 0.001      |
| └── 0d5e1ae [exp-25fae] | 06:03 PM     | 0.26133 | 0.9062     | 128                | 0.4             | 0.001      |
`dvc exp show --drop train.*`
| Experiment              | Created      | loss    | accuracy   |
|-------------------------|--------------|---------|------------|
| workspace               | -            | 0.31941 | 0.8997     |
| main                    | Sep 14, 2021 | 0.26484 | 0.9038     |
| β”œβ”€β”€ d599d35 [exp-4f1f0] | 06:12 PM     | 0.31941 | 0.8997     |
| β”œβ”€β”€ c6d3ac6 [exp-eec4c] | 06:10 PM     | 0.24435 | 0.9135     |
| └── 0d5e1ae [exp-25fae] | 06:03 PM     | 0.26133 | 0.9062     |
`dvc exp show --drop train.* --keep train.dropout`
| Experiment              | Created      | loss    | accuracy   | train.dropout   |
|-------------------------|--------------|---------|------------|-----------------|
| workspace               | -            | 0.31941 | 0.8997     | 0.3             |
| main                    | Sep 14, 2021 | 0.26484 | 0.9038     | 0.4             |
| β”œβ”€β”€ d599d35 [exp-4f1f0] | 06:12 PM     | 0.31941 | 0.8997     | 0.3             |
| β”œβ”€β”€ c6d3ac6 [exp-eec4c] | 06:10 PM     | 0.24435 | 0.9135     | 0.3             |
| └── 0d5e1ae [exp-25fae] | 06:03 PM     | 0.26133 | 0.9062     | 0.4             |
`dvc exp show --only-changed --drop Created`
| Experiment              | loss    | accuracy   | train.dropout   | train.lr   |
|-------------------------|---------|------------|-----------------|------------|
| workspace               | 0.31941 | 0.8997     | 0.3             | 0.01       |
| main                    | 0.26484 | 0.9038     | 0.4             | 0.001      |
| β”œβ”€β”€ d599d35 [exp-4f1f0] | 0.31941 | 0.8997     | 0.3             | 0.01       |
| β”œβ”€β”€ c6d3ac6 [exp-eec4c] | 0.24435 | 0.9135     | 0.3             | 0.001      |
| └── 0d5e1ae [exp-25fae] | 0.26133 | 0.9062     | 0.4             | 0.001      |

For #7080

`dvc exp show --only-changed --drop Experiment --drop Created`
| loss    | accuracy   | train.dropout   | train.lr   |               
|---------|------------|-----------------|------------|
| 0.31941 | 0.8997     | 0.3             | 0.01       |
| 0.26484 | 0.9038     | 0.4             | 0.001      |
| 0.31941 | 0.8997     | 0.3             | 0.01       |
| 0.24435 | 0.9135     | 0.3             | 0.001      |
| 0.26133 | 0.9062     | 0.4             | 0.001      |

@daavoo daavoo force-pushed the merge-include-exclude branch 2 times, most recently from 02c2675 to 94a8c83 Compare December 14, 2021 20:28
@daavoo daavoo marked this pull request as ready for review December 14, 2021 20:47
@daavoo daavoo requested a review from a team as a code owner December 14, 2021 20:47
@daavoo daavoo requested a review from karajan1001 December 14, 2021 20:49
@pmrowla
Copy link
Contributor

pmrowla commented Dec 15, 2021

How does filtering with the new options work if there is a metric and parameter with the same name?

@karajan1001
Copy link
Contributor

Cool, I don't like the old _filter_name and _filter_names.

dvc/compare.py Outdated Show resolved Hide resolved
@daavoo
Copy link
Contributor Author

daavoo commented Dec 15, 2021

How does filtering with the new options work if there is a metric and parameter with the same name?

User need to indicate the pattern matching the final column. So if there is a shared name, user would need to --drop params.yaml:foo or --drop *foo

dberenbaum
dberenbaum previously approved these changes Dec 15, 2021
Copy link
Collaborator

@dberenbaum dberenbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Nice simplification of the UI.

The big question is whether removing --include flags will make it too hard to filter the table. Now that we have --only-changed, the hope is that this will cover a lot that filtering automatically (along with --drop).

We haven't had much feedback recently on the table filtering, so let's try it and see what people think.

@daavoo
Copy link
Contributor Author

daavoo commented Dec 16, 2021

Looks great! Nice simplification of the UI.

The big question is whether removing --include flags will make it too hard to filter the table. Now that we have --only-changed, the hope is that this will cover a lot that filtering automatically (along with --drop).

We haven't had much feedback recently on the table filtering, so let's try it and see what people think.

I was thinking that if we support regex matching instead of fnmatch there would be no need of --keep and users could perform similar behavior to previous --include.

I'm Ok with adding regex and just examples in docs. @dberenbaum WDYT?

@dberenbaum
Copy link
Collaborator

I was thinking that if we support regex matching instead of fnmatch there would be no need of --keep and users could perform similar behavior to previous --include.

I'm Ok with adding regex and just examples in docs. @dberenbaum WDYT?

I knew we had this discussion before πŸ˜„ : #5720 (comment).

No strong preference from me. Not sure if regex is less consistent with the rest of the dvc cli, but obviously it's more powerful, so 🀷 .

@daavoo daavoo force-pushed the merge-include-exclude branch 3 times, most recently from 2954e0f to d6da3ef Compare December 16, 2021 17:47
@daavoo daavoo requested a review from karajan1001 December 16, 2021 17:47
@pmrowla
Copy link
Contributor

pmrowla commented Dec 17, 2021

@daavoo this needs a rebase, exp commands have been split into their own files (so dvc/commands/experiments/show.py) since there was getting to be way too much stuff in commands/experiments.py

@daavoo daavoo force-pushed the merge-include-exclude branch from d6da3ef to 31c80dd Compare December 17, 2021 17:14
@daavoo
Copy link
Contributor Author

daavoo commented Dec 17, 2021

@daavoo this needs a rebase, exp commands have been split into their own files (so dvc/commands/experiments/show.py) since there was getting to be way too much stuff in commands/experiments.py

Done. I had already done that one but this required a new one because of the parallel coordinates merge

@jorgeorpinel
Copy link
Contributor

jorgeorpinel commented Dec 22, 2021

Nice. On first sight it's not clear to me what the difference between include and keep are but we'll worry about that in the docs PR. Just one Q: Does the order in which filters are given matter? I.e. if I keep something and then drop the same something what happens? I'd even try --keep foo --drop foo --keep foo P: and see what happens. Thanks

UPDATE: I guess it's already explained in iterative/dvc.org#3112 so nvmd.

@daavoo daavoo force-pushed the merge-include-exclude branch 4 times, most recently from d3837ab to 0b00d17 Compare December 27, 2021 15:42
dvc/compare.py Outdated Show resolved Hide resolved
dvc/compare.py Show resolved Hide resolved
@daavoo daavoo force-pushed the merge-include-exclude branch 4 times, most recently from 802dfd1 to c8582f9 Compare December 30, 2021 14:04
@skshetry skshetry requested a review from pmrowla January 3, 2022 10:38
@daavoo daavoo requested a review from karajan1001 January 3, 2022 15:09
dvc/compare.py Outdated Show resolved Hide resolved
@daavoo daavoo force-pushed the merge-include-exclude branch from c8582f9 to 556a6db Compare January 3, 2022 18:48
@lgtm-com
Copy link

lgtm-com bot commented Jan 3, 2022

This pull request introduces 1 alert when merging 556a6db97d321d86cf56bfe8df8899e199aeb2f4 into 0a4958b - view on LGTM.com

new alerts:

  • 1 for Unused import

@daavoo daavoo marked this pull request as draft January 3, 2022 19:15
@daavoo daavoo force-pushed the merge-include-exclude branch from 556a6db to 22829cd Compare January 3, 2022 19:53
@daavoo daavoo marked this pull request as ready for review January 3, 2022 19:53
@daavoo daavoo requested a review from skshetry January 3, 2022 19:54
@daavoo daavoo force-pushed the merge-include-exclude branch from 22829cd to 2035b90 Compare January 3, 2022 21:03
dvc/command/experiments/show.py Outdated Show resolved Hide resolved
dvc/command/experiments/show.py Outdated Show resolved Hide resolved
TabularData: Add subset arg to dropna and drop_duplicates.

Closes #7083
Removed `--include-metrics` / `--include-params` and
`--exclude-metrics` / `--exclude-params`.

Removed `--no-timestamp` . Can be done by `--drop Created`.

`--drop` and `--keep` operate directly on the table columns.

`--keep` does not perform any filtering. It's only used
to specify columns to keep despite the other filtering.

For example `--only-changed --keep foo` will prevent
`foo` from being removed by `--only-changed`.

Another example, `--drop train.* --keep train.dropout`
will remove all columns matching `train.*` except for
`train.dropout`.

Closes #7079
Closes #7080
Pre-requisite for #6434
@daavoo daavoo force-pushed the merge-include-exclude branch from 2035b90 to 11c687a Compare January 19, 2022 18:03
@daavoo daavoo requested a review from karajan1001 January 19, 2022 18:08
@daavoo daavoo enabled auto-merge (rebase) January 19, 2022 18:09
Copy link
Contributor

@karajan1001 karajan1001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, in the most parts.

to_remove = set()
for col in col_names:
if not self.is_protected(col):
to_remove.add(col)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about remove to_remove and directly:

        for col in col_names:
            if not self.is_protected(col):
                self._keys.remove(col)
                self._columns.pop(col)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It merged automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dvc/compare.py Show resolved Hide resolved
@daavoo daavoo merged commit 43953ac into main Jan 20, 2022
@daavoo daavoo deleted the merge-include-exclude branch January 20, 2022 02:28
@efiop efiop added the enhancement Enhances DVC label Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances DVC
Projects
None yet
7 participants