"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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 607cc3a8b2c3c2db2eda5a7b374055bf3f10d4e614a2d56c833cb81be2c3dc37 |
|
MD5 | e6fdddbb1dc0daf553fa9d271eb0c49a |
|
BLAKE2b-256 | dd8989d8e4870824fce88f5ff9b09e67b479d66bd0917d3ac1880c292049c200 |
Close
Hashes for pytorch_partial_crf-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b67a6e246fdfc13f096f9014852b16170f083799bfe42c04cfa7de93f0ca5a0 |
|
MD5 | 6abee622e6f6059f1ce1941b36272199 |
|
BLAKE2b-256 | 53c8b8174965c99a07a3b30841aaf14d87a7885284c4c4645076e492d272d796 |