"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.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b6b7f69fc6dd179f5865929d84ae43bee1ba8183b2f2491612d8e157b4a6526 |
|
MD5 | 828cb327208030f48b98385cbe2b72d7 |
|
BLAKE2b-256 | afb51c6b7235005be0a1cbe909434d7c9511f3d16f0509df8a2913989c68d45b |
Close
Hashes for pytorch_partial_crf-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2942c4ccae40a4a45da88836e7d346c8876e20589d14bdd8a0313767edd8d91 |
|
MD5 | 18b429a80fbf96918454d575d0e88eb2 |
|
BLAKE2b-256 | e55aad4c11dcfe12f5c9abfec9864c68d5cf270c53929b8ac58f3ed45c42dd03 |