"Partial/Fuzzy Conditional random field in PyTorch."
Project description
pytorch-partial-crf
Partial/Fuzzy conditional random field in PyTorch.
How to use
Install
pip install pytorch-partial-crf
Use partial CRF
import torch
from pytorch_partial_crf import PartialCRF
# Create
num_tags = 6
model = PartialCRF(num_tags)
batch_size, sequence_length = 3, 5
emissions = torch.randn(batch_size, sequence_length, num_tags)
# Set unknown tag to -1
tags = torch.LongTensor([
[1, 2, 3, 3, 5],
[-1, 3, 3, 2, -1],
[-1, 0, -1, -1, 4],
])
# Computing log likelihood
model(emissions, tags)
License
MIT
References
The implementation is based on AllenNLP CRF module and pytorch-crf.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pytorch-partial-crf-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a538a8376c724708d0168d84c212b3d374de16eba28db85282129ce46b24f25b |
|
MD5 | 865233833b3a34ece629a229077cc1a9 |
|
BLAKE2b-256 | c7f8d661a00bb0f0c25db070a71db435cd43fadb871f2f73aff2ff66f1c0fd10 |
Close
Hashes for pytorch_partial_crf-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f25b4b206fc3453740599f0ed7757e60819e40c4ede2183fac598390fb24aff7 |
|
MD5 | 3ab89790e3ffb10c8ab40bcbb96f7ea2 |
|
BLAKE2b-256 | 77bbba3dc2c761d533d24a848e4f03fe99e55aa71729db07477d23e9ee4e689d |