wbn
Weighted Bayesian Network Text Classification
Free software: MIT license
Documentation: https://wbn.readthedocs.io.
Installation
From source
$ git clone https://github.com/leonkozlowski/wbn.git
$ cd wbn
$ python3.8 -m venv venv
$ pip install -e .
Usage
Building, training, and testing WBN
from sklearn.model_selection import train_test_split
# Import WBN
from wbn.classifier import WBN
from wbn.sample.datasets import load_pr_newswire
# Build the model
wbn = WBN()
# Load a sample dataset
pr_newswire = load_pr_newswire()
# Train/test split
x_train, x_test, y_train, y_test = train_test_split(
pr_newswire.data, pr_newswire.target, test_size=0.2
)
# Fit the model
wbn.fit(x_train, y_train)
# Testing the model
pred = wbn.predict(x_test)
# Reverse encode the labels
y_pred = wbn.reverse_encode(target=pred)
Constructing a new dataset:
import pickle
# Import data structures for dataset creation
from wbn.object import Document, DocumentData, Documents
# Load your dataset from csv or pickle
with open("dataset.pickle"), "rb") as infile:
raw_data = pickle.load(infile)
# De-structure 'data' and 'target'
data = raw_data.get("data")
target = raw_data.get("target")
# Construct Document's for each data/target entry
documents = Documents(
[
Document(DocumentData(paragraphs, keywords), target[idx])
for idx, (paragraphs, keywords) in enumerate(data)
]
)
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2020-11-03)
First release on PyPI.
Metadata
Release files for wbn 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wbn-0.1.0.tar.gz | 17.1 kB | Without provenance | Details for wbn-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wbn-0.1.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for wbn-0.1.0-py2.py3-none-any.whl |
Total release size: 26.3 kB
Release files / wbn-0.1.0.tar.gz
| Download URL | wbn-0.1.0.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a86a39bb50d333c51dea225bab3bedf850d23eaf4be2d8da07af2bc02711aff
|
|
BLAKE2b-256 checksum How to use checksums |
435c98a37ecc07e144b2b83809599fc05b7fe2dcd031bb441c7b657eae374421
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6
|
Release files / wbn-0.1.0-py2.py3-none-any.whl
| Download URL | wbn-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0f63edc48049b974fa19faf20089b1eff3edbada098c928f1a6fa132d63df43c
|
|
BLAKE2b-256 checksum How to use checksums |
50248f0c6e3dc62f3e0c686c8b0aec3266ee1c37672963191aab3c28f86f0df1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6
|
Security for wbn 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.