"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)
# Computing log likelihood
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],
])
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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b38f24a0b4b0fc8eecc1e6ec3737dc9ad653819f9d5e8741ae960bfd7b1265f4 |
|
MD5 | 65a9ef848fe40e38684e2998e6d12b93 |
|
BLAKE2b-256 | 68e9c5f79267fe26a4296665d61f1b409a2b910f99b4bf86890da54568366e89 |
Close
Hashes for pytorch_partial_crf-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8e399a87da42cce82997d04dba34324f3cc39c792445dd88297614e5f7151db |
|
MD5 | 8909930c1f0dc59cf0c7ab85362478e5 |
|
BLAKE2b-256 | 2d2be632479a54f4bac491f4e2dc9cad5509d903fe51680bb4c8c25de6d9e4cf |