Skip to content

Conversation

@daavoo
Copy link
Contributor

@daavoo daavoo commented Oct 25, 2021

dvc.org P.R: treeverse/dvc.org#2966

Closes #5966

Also, pre-requisite for #4455


Demo:

$ dvc exp show
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Experiment            ┃ Created      ┃     auc ┃ featurize.max_fea… ┃ featurize.ngrams ┃ prepare.seed ┃ prepare.split ┃ train.n_estimators ┃ train.seed ┃
┑━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
β”‚ workspace             β”‚ -            β”‚ 0.61314 β”‚ 1500               β”‚ 2                β”‚ 20170428     β”‚ 0.2           β”‚ 50                 β”‚ 20170428   β”‚
β”‚ 10-bigrams-experiment β”‚ Jun 20, 2020 β”‚ 0.61314 β”‚ 1500               β”‚ 2                β”‚ 20170428     β”‚ 0.2           β”‚ 50                 β”‚ 20170428   β”‚
β”‚ β”œβ”€β”€ exp-e6c97         β”‚ Oct 21, 2020 β”‚ 0.61314 β”‚ 1500               β”‚ 2                β”‚ 20170428     β”‚ 0.2           β”‚ 50                 β”‚ 20170428   β”‚
β”‚ β”œβ”€β”€ exp-1dad0         β”‚ Oct 09, 2020 β”‚ 0.57756 β”‚ 2000               β”‚ 2                β”‚ 20170428     β”‚ 0.2           β”‚ 50                 β”‚ 20170428   β”‚
β”‚ └── exp-1df77         β”‚ Oct 09, 2020 β”‚ 0.51676 β”‚ 500                β”‚ 2                β”‚ 20170428     β”‚ 0.2           β”‚ 50                 β”‚ 20170428   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
$ dvc exp show --only-changed
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Experiment            ┃ Created      ┃     auc ┃ featurize.max_features ┃
┑━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ workspace             β”‚ -            β”‚ 0.61314 β”‚ 1500                   β”‚
β”‚ 10-bigrams-experiment β”‚ Jun 20, 2020 β”‚ 0.61314 β”‚ 1500                   β”‚
β”‚ β”œβ”€β”€ exp-e6c97         β”‚ Oct 21, 2020 β”‚ 0.61314 β”‚ 1500                   β”‚
β”‚ β”œβ”€β”€ exp-1dad0         β”‚ Oct 09, 2020 β”‚ 0.57756 β”‚ 2000                   β”‚
β”‚ └── exp-1df77         β”‚ Oct 09, 2020 β”‚ 0.51676 β”‚ 500                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

@daavoo daavoo requested a review from a team as a code owner October 25, 2021 19:47
@daavoo daavoo requested a review from pared October 25, 2021 19:47
@daavoo daavoo added the feature is a feature label Oct 25, 2021
@daavoo daavoo self-assigned this Oct 25, 2021
Copy link
Contributor

@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.

I'm not sure about the name or description. There are two possible meaning of changed values:

  1. Whether the table column has 0 variance/all the same values. This is the current feature AFAIK.
  2. Whether the experiment value changed from its parent commit. I think this is technically closer to what was requested in #5966 and #6778.

The behavior will be similar since I think exp show always includes the parent commit with its associated experiments. I think the only time it will be different is if two parent commits have different values but the experiments don't modify those values.

Since this is pretty minor, the current functionality makes sense and is intuitive. However, I do think we should be precise about the meaning, especially since we might have other functionality to show changes from the parent commit (we could use highlighting for that, for example).

What do you think? Is there a better option name or description to summarize the behavior?

@dberenbaum
Copy link
Contributor

How does this interact with other --include/--exclude options? Should we specify and test for those?

@daavoo
Copy link
Contributor Author

daavoo commented Oct 26, 2021

How does this interact with other --include/--exclude options? Should we specify and test for those?

This is the last operation applied before rendering the table. It is applied to the TabularData whereas --include/--exclude options are applied before TabularData is created.

We might need to specify that (in the current state of the P.R.) --only-changed might "ignore" the --include flags For example, if you --include some param/metric that doesn't vary across experiments, it will not be shown. For --exclude the two flags are just complementary.

@dberenbaum
Copy link
Contributor

We might need to specify that (in the current state of the P.R.) --only-changed might "ignore" the --include flags

Do you think this makes sense from a user perspective? I would probably expect --include to override since it's the more specific option.

@skshetry
Copy link
Collaborator

skshetry commented Oct 26, 2021

One question that I have, what do the users care more about: looking through the entire history of parameters/metrics or just a few recent experiments? I know there are use-cases for both of those but just wanted to understand which one do you guys think is more important.

Looking at the current complexity of dvc exp show and our plans to add pipelines/data changes into it, maybe we are optimizing the wrong commands instead of improving exp diff and exp list?

@daavoo
Copy link
Contributor Author

daavoo commented Oct 26, 2021

We might need to specify that (in the current state of the P.R.) --only-changed might "ignore" the --include flags

Do you think this makes sense from a user perspective? I would probably expect --include to override since it's the more specific option.

Before introducing this command, I have always considered both --include and --exclude useful for filtering out metrics/params (because --include actually means --only-include).

However, I understand that users might expect --include to prevail when combined with this new option. I will update the P.R. to handle that.

dvc/compare.py Outdated
{k: self._columns[k][i] for k in keys} for i in range(len(self))
]

def drop_duplicates(self, axis: str):
Copy link
Collaborator

@skshetry skshetry Oct 26, 2021

Choose a reason for hiding this comment

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

My plan for TabularData was to evolve the APIs to mirror those of like pandas and then split it into a separate library. I love that you are also taking the inspiration.

I did make a mistake on the internals of it, and by locking the type to just str instead of arbitrary data (and, no support for NaN :(), which I did mostly for performance reasons as we'd have to coerce during rendering. If you are fighting too much with the internals, please feel free to change it. As I said, my plan is to split it as a pure-python lightweight pandas library in the future when we improve APIs and internals πŸ™‚ (we could separate it today too).

Copy link
Contributor Author

@daavoo daavoo Oct 26, 2021

Choose a reason for hiding this comment

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

That's very good to hear.

In fact, preserving the original type was one of the next steps I was about to bring up for discussion. It is not a fully blocker for the parallel coordinates but it would definitely make it easier to integrate.

I also felt that TabularData was becoming a good candidate to be one of the core components of the future experiments.api; I assume you also felt that way?

Copy link
Collaborator

@skshetry skshetry Oct 26, 2021

Choose a reason for hiding this comment

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

The arbitrary-type support would allow us to support custom serializers for NaNs (instead of hacking around with fill_value), float values (instead of putting the responsibility on the caller) and composite objects (dict/list). Though at the expense of performance.

I also felt that TabularData was becoming a good candidate to be one of the core components of the future experiments.api

I am not really sure what experiments.api is, or what its scope is tbh. One thing to keep in mind though, the CLI that we render is actually a nested table, a table for each commit, and each table having their n number of experiments, which is flattened later. This is why the --include/--exclude and --sort-by does not really translate well to the TabularData. pandas does support nested tables, but I don't think it's worth complicating it here. I am not sure if we need to distinguish between that for experiments.api.

@daavoo
Copy link
Contributor Author

daavoo commented Oct 26, 2021

I'm not sure about the name or description. There are two possible meaning of changed values:

1. Whether the table column has 0 variance/all the same values. This is the current feature AFAIK.

2. Whether the experiment value changed from its parent commit. I think this is technically closer to what was requested in #5966 and #6778.

The behavior will be similar since I think exp show always includes the parent commit with its associated experiments. I think the only time it will be different is if two parent commits have different values but the experiments don't modify those values.

Since this is pretty minor, the current functionality makes sense and is intuitive. However, I do think we should be precise about the meaning, especially since we might have other functionality to show changes from the parent commit (we could use highlighting for that, for example).

What do you think? Is there a better option name or description to summarize the behavior?

I'm not fully understanding the meaning of point number 2. Could you please share an example of what would be expected behavior with some fake data?

@dberenbaum
Copy link
Contributor

I'm not fully understanding the meaning of point number 2. Could you please share an example of what would be expected behavior with some fake data?

Let's say the output with the current functionality looks like:

$ dvc exp show --only-changed
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Experiment            ┃ Created      ┃     auc ┃ featurize.max_features ┃
┑━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ workspace             β”‚ -            β”‚ 0.61314 β”‚ 1500                   β”‚
β”‚ 10-bigrams-experiment β”‚ Jun 20, 2020 β”‚ 0.61314 β”‚ 1500                   β”‚
β”‚ β”œβ”€β”€ exp-e6c97         β”‚ Oct 21, 2020 β”‚ 0.61314 β”‚ 1500                   β”‚
β”‚ β”œβ”€β”€ exp-1dad0         β”‚ Oct 09, 2020 β”‚ 0.57756 β”‚ 1500                   β”‚
β”‚ └── exp-1df77         β”‚ Oct 09, 2020 β”‚ 0.51676 β”‚ 1500                   β”‚
β”‚ 9-bigrams-model       β”‚ Jun 20, 2020 β”‚ 0.53238 β”‚ 2000                   β”‚
β”‚ └── exp-f780a         β”‚ Oct 21, 2020 β”‚ 0.54398 β”‚ 2000                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technically, no experiments being shown change featurize.max_features from their parent commit. It would be weird to not show the featurize.max_features column in this case, so I'm definitely not suggesting changing the behavior, but I think we need to explain it. Actually, I think the the description in treeverse/dvc.org#2966 is pretty accurate:

 - `--only-changed` - Only show metrics/params with values varying across the
  selected experiments.

@dberenbaum
Copy link
Contributor

Looking at the current complexity of dvc exp show and our plans to add pipelines/data changes into it, maybe we are optimizing the wrong commands instead of improving exp diff and exp list?

Good point. Should we discuss in a separate issue/discussion?

@daavoo
Copy link
Contributor Author

daavoo commented Oct 27, 2021

Looking at the current complexity of dvc exp show and our plans to add pipelines/data changes into it, maybe we are optimizing the wrong commands instead of improving exp diff and exp list?

Good point. Should we discuss in a separate issue/discussion?

Referenced in #6451

@daavoo daavoo force-pushed the exp-show-only-changed branch 3 times, most recently from 1b67f26 to a6f470c Compare October 27, 2021 11:45
Copy link
Contributor

@pared pared left a comment

Choose a reason for hiding this comment

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

I am fine with the current state,
but the question is whether we want to discuss @skshetry comment first?

@dberenbaum
Copy link
Contributor

I am fine with the current state,
but the question is whether we want to discuss @skshetry comment first?

I don't think it should block this PR, especially since this PR is pretty well aligned with the concerns raised by @skshetry. It's not like it's adding more to the output of exp show.

@daavoo daavoo changed the title Introduce exp show --only-changed exp show: Add --only-changed option Oct 27, 2021
@daavoo daavoo force-pushed the exp-show-only-changed branch from a6f470c to dd986f1 Compare October 27, 2021 17:26
@daavoo daavoo added A: experiments Related to dvc exp A: diff/show labels Oct 27, 2021
@efiop
Copy link
Contributor

efiop commented Oct 29, 2021

@daavoo Please rebase

This method mimics pandas `drop_duplicates` when axis=rows.

For axis=cols this method will drop columns with 0-variance (only
1 unique value). NaNs (`_fill_value`) won't be counted as unique values.

So the following column (`-` would be the `_fill_value`) will be dropped:

foo
-
foo
foo
Use TabularData `drop_duplicates` to only show metrics/params with values varying across the selected experiments.

Fixes #5966
@daavoo daavoo force-pushed the exp-show-only-changed branch from dd986f1 to c597e98 Compare October 29, 2021 12:49
@daavoo
Copy link
Contributor Author

daavoo commented Oct 29, 2021

@daavoo Please rebase

That's all I do these days 🧐

@daavoo daavoo requested a review from efiop October 29, 2021 15:04
@efiop efiop merged commit 72066f2 into master Nov 10, 2021
@efiop efiop deleted the exp-show-only-changed branch November 10, 2021 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A: experiments Related to dvc exp feature is a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

exp show: show only changed parameters

5 participants