"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.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b88fee1c0f35059c4a3fc69091c704c9614494dba9d65453806ff800a1c218ea |
|
MD5 | 52d683a51fbd093e9e6d6f434ee2d3f3 |
|
BLAKE2b-256 | 4c7becd72d1eaecc771a1fbb973e4c2ebf0474ac0f755a002972b65258cb8b6a |
Close
Hashes for pytorch_partial_crf-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb1d4b9998d60edbf5747ffd1a53986d3a0cca0d7822241d2484ca5fe47a9629 |
|
MD5 | d597d73e575a903f7861ccc56908e118 |
|
BLAKE2b-256 | 7b3254c5bce55fbfaae17cd54b3954241ffa9fe8e91e441facefbb784a9b9360 |