"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
File details
Details for the file pytorch-partial-crf-0.0.5.tar.gz
.
File metadata
- Download URL: pytorch-partial-crf-0.0.5.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10b12ce397a087ec7859ee944aeb36ea6d1f8d9024579c52a6fbaf26ea875104 |
|
MD5 | 4377c6fe4a8c734a8604987f8f9f2505 |
|
BLAKE2b-256 | 66c680a782696897b33f31d4e20d2fca6a51c2fa9e7006a2fefd1f7a866075d7 |
File details
Details for the file pytorch_partial_crf-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: pytorch_partial_crf-0.0.5-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c62db68b2ef4b4183a4568d89034c7dc1f7b2f6cba189544c8363281ad028a4 |
|
MD5 | 2c8a633eed5271b778c64021e97f1499 |
|
BLAKE2b-256 | 937d0d9d6b8760e92763543524fb853eb63b71c89da9ee1b7a0cbe6df686ce45 |