"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.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08b578426267b51b924e7db0399d06db2e6827ad7b18df73d168657cc18542d6 |
|
MD5 | da3d5365170da86fbd9bf3e9ac22b7d0 |
|
BLAKE2b-256 | c1b9359a36497daa07c422fc50a02ac3b66c2309d5d1dcf1c6f911f62e10cfaf |
Close
Hashes for pytorch_partial_crf-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7152e5e70b14b72c515ff0bd501714cbde6ae78ce4b1bc047743075bd7230d63 |
|
MD5 | 36e959729b8ed59fbeb523b40e8b2217 |
|
BLAKE2b-256 | 679826fd01612eade26515161d7017466af52a36d9796e6354f1b81430c1fb6a |