aggregate the result of DocumentStatistic #313
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modifies the
DocumentStatistic
DEFAULT_AGGREGATION_FUNCTIONS: List[str]
(the fucntion names are resolved against some inhouse methods (mean
,median
,std
), or python builtin functions and, if this does not work, against the global namespace viautils.hydra.resolve_target
).show_histogram
: IffTrue
(default:False
), show the histogram of the collected values withplotext
on the consoleshow_as_markdown
: IffTrue
(default:False
), show the result as markdown on the console (requires thetabulate
package)title
: this is used in the histogram and markdown table captionsThis also adds the property
current_split
to theDocumentMetric
which is available when processing a dataset dict.Note: This is breaking with respect to #312 because before this PR, the
DocumentStatistic
returned a dict with list values, but now the values are aggregated (we do not label it as breaking because #312 was not yet part of a release). However, by usingaggregation_functions=["list"]
the previous behavior can be more or less restored (just the keys are a bit different).