Observed since 21 Oct, 11:18 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A library for basic NLP metric score implementations
AI Metrics is a Python library for basic Natural Language Processing (NLP) metric score implementations. This library provides various metrics commonly used in evaluating NLP models, such as accuracy, BERT score, BLEU score, and ROUGE score.
You can install the library using pip. First, clone the repository:
git clone https://github.com/hari-hud/ai-metrics.git
cd ai-metrics
Then, install the dependencies:
pip install -r requirements.txt
Finally, install the library in editable mode:
pip install -e .
Here are some examples of how to use the different metrics provided by the library:
from metrics.nlp.accuracy_score import AccuracyScore
ground_truths = ["label1", "label2", "label3"]
predictions = ["label1", "label2", "label3"]
accuracy = AccuracyScore()
score = accuracy.get_score(ground_truths, predictions)
print(score) # Output: {'accuracy': 1.0}
from metrics.nlp.bert_score import BertScore
ground_truths = ["The cat is on the mat."]
predictions = ["The cat is sitting on the mat."]
bert_score = BertScore()
score = bert_score.get_score(ground_truths, predictions)
print(score) # Output: {'bert_f1': <float_value>}
from metrics.nlp.bleu_score import BLEUScore
ground_truths = ["The cat is on the mat."]
predictions = ["The cat is on the mat."]
bleu = BLEUScore()
score = bleu.get_score(ground_truths, predictions)
print(score) # Output: {'bleu_score': <float_value>}
from metrics.nlp.rouge_score import ROUGEScores
ground_truths = ["The cat sat on the mat."]
predictions = ["The cat sat on the mat."]
rouge = ROUGEScores()
score = rouge.get_score(ground_truths, predictions)
print(score) # Output: {'rouge_1_score': <float_value>, 'rouge_2_score': <float_value>, ...}
You can run the tests using pytest. To run all tests, execute:
pytest tests/
Contributions are welcome! Please feel free to submit a pull request or open an issue.
git checkout -b feature/YourFeature)git commit -m 'Add some feature')git push origin feature/YourFeature)This project is licensed under the Apache License 2.0. See the LICENSE file for details.
For any questions or suggestions, please contact:
Hari Hud
Email: hudharibhau@nvidia.com
GitHub: hari-hud
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.0.1 | 28 Sept 2024 | 4 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 11:18 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:f30cd09d1e4119275fae48a1bc382ddc99db1a84a29722b4891bb89d9a26c3c0