"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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d95474c58b64874157f4b07bf85840b2942d66d2d8fea5fd4eef965a2d04c6d |
|
MD5 | bbff596538b6c08fa034a6cc397f68f6 |
|
BLAKE2b-256 | c4a3d464f52baaa025d1bad9f85fccc27cfb4f2f1f538ff486d8063bc7da5f85 |
Close
Hashes for pytorch_partial_crf-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3fb64bb7f341ed651f39f3559e60ab752161574492bd2b124f01b59f51f4009 |
|
MD5 | 5d19b189ee1c1d127e453594e74faf1f |
|
BLAKE2b-256 | 0e845de613e61db1949d3be0c7f357dac0ae4478bbabba2881772bdaacef69f3 |