adding scripts and tests for naturalness metric #130
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.
PR for feature addition related to issue 129.
Motivation:
In Summarization, Generation, and Style Transfer Tasks, it is also useful to check the Fluency/ Coherence of the generated outputs (references in this case). The traditional method of using perplexity depends highly on the architecture of the pre-trained model chosen and does not correlate with human correlations as well as other newly introduced metrics. The "Naturalness" metric, for example, uses a Neural Classifier whose task is to determine whether a given sentence is a real English sentence or a fake. It is shown more to correlate with human judgments in determining the coherence of the generated outputs. This feature might be of use for people will similar needs.
Please refer to the full publication for more information: https://aclanthology.org/N19-1049/
Feature Addition:
The "Naturalness" metric has been added to
scores
variable in both functions calls and the NLGEval API. Unit tests to validate this metric has been added intest_nlgevals.py
. All dependencies for this metric have been added to thenlgeval/naturalness
directory, complying with the design architecture of the other metrics.Behaviour:
The metric calculates the mean Naturalness score of the references provided. In case a list of references is provided (such as in
NLGEval.compute_metrics()
), the mean naturalness score of the union of all lists is calculated.Please let me know your thoughts on this feature addition or if anything changes are required. Thanks!