Skip to main content

Testing framework for sequence labeling

Project description


# seqeval
seqeval is a Python framework for sequence labeling evaluation.
seqeval can evaluate the performance of chunking tasks such as named-entity recognition, part-of-speech tagging, semantic role labeling and so on.

This is well-tested by using the Perl script [conlleval](https://www.clips.uantwerpen.be/conll2002/ner/bin/conlleval.txt),
which can be used for measuring the performance of a system that has processed the CoNLL-2000 shared task data.

## Support features
seqeval supports following formats:
* IOB1
* IOB2
* IOE1
* IOE2
* IOBES

and supports following metrics:

| metrics | description |
|---|---|
| accuracy_score(y\_true, y\_pred) | Compute the accuracy. |
| precision_score(y\_true, y\_pred) | Compute the precision. |
| recall_score(y\_true, y\_pred) | Compute the recall. |
| f1_score(y\_true, y\_pred) | Compute the F1 score, also known as balanced F-score or F-measure. |
| classification_report(y\_true, y\_pred, digits) | Build a text report showing the main classification metrics. |

## Usage
Behold, the power of seqeval:

```python
>>> from seqeval.metrics import accuracy_score
>>> from seqeval.metrics import classification_report
>>> from seqeval.metrics import f1_score
>>>
>>> y_true = [['O', 'O', 'O', 'B-MISC', 'I-MISC', 'I-MISC', 'O'], ['B-PER', 'I-PER', 'O']]
>>> y_pred = [['O', 'O', 'B-MISC', 'I-MISC', 'I-MISC', 'I-MISC', 'O'], ['B-PER', 'I-PER', 'O']]
>>>
>>> f1_score(y_true, y_pred)
0.50
>>> accuracy_score(y_true, y_pred)
0.80
>>> classification_report(y_true, y_pred)
precision recall f1-score support

MISC 0.00 0.00 0.00 1
PER 1.00 1.00 1.00 1

avg / total 0.50 0.50 0.50 2
```

## Installation
To install seqeval, simply run:

```
$ pip install seqeval
```

## Requirement
* numpy >= 1.14.0


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

seqeval-0.0.5-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file seqeval-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: seqeval-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.1

File hashes

Hashes for seqeval-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 788bc2cd5786b13fad2f9334a255a039bef997cc7b53e2f491b697bc32ab9e6b
MD5 02c30bc7e9aee98e6e9eea70c82561fe
BLAKE2b-256 dcb66e58b54c0fa343f9c24969cb887f3e76c13d16dded640cc620a914f27dc4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page