"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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d793622c37e26665b75c4b229d41972b6016bfbb99d3b03212a24bdcc0c1a785 |
|
MD5 | 06da25da84156dcaeda2fa3466838236 |
|
BLAKE2b-256 | 29f06c9ece7da5a1f8d3efd057634e9913564496d8b52950e8f69b5b62fa0c61 |
Close
Hashes for pytorch_partial_crf-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d448c85699cc58df744efec3e57ff70e0ef185c00fcf31e64405199422e10a17 |
|
MD5 | 343f3838ceb2b0a7c0816504564aff34 |
|
BLAKE2b-256 | 7f6908d62fe1063a59fdae8c3599dd422d99696fbc7f2b721ba09b901900730b |