Skip to content
tbnb needs quanteda, which CRAN will archive unless its check problems are fixed by Oct 22.

Threshold-Based and Iterative Threshold-Based Naive Bayes Classifier

0packages depend
685downloads / year
79.1%test coverage
13/13flavors OK

Overview

About

Implements the Threshold-Based Naive Bayes (Tb-NB) classifier and its iterative refinement (iTb-NB) for binary sentiment / text classification problems. The classifier computes a continuous log-likelihood ratio score per document and uses a data-driven decision threshold estimated via K-fold cross-validation on a user-selected criterion (accuracy, F1 score, Matthews correlation coefficient, balanced error, etc.). An optional iterative refinement procedure locally re-estimates the threshold in regions of class overlap using either Gaussian kernel density estimation or a Central Limit Theorem bootstrap approximation. The package exposes an idiomatic R formula + data.frame interface together with a 'quanteda'-based text preprocessing pipeline, supports user-supplied document-feature matrices, and includes an optional word-embedding extension that augments the Bag-of-Words with K nearest semantic neighbours of each token. The package additionally implements the p-value extension proposed by Romano (2025) for both document- and feature-level interpretability via tbnb_pvalues(). Methods are described in Romano, Contu, Mola, Conversano (2024) doi:10.1007/s11634-023-00536-8, Romano, Zammarchi, Conversano (2024) doi:10.1007/s10260-023-00721-1, and Romano (2025) doi:10.1007/978-3-031-96736-8_41.

Changes in 0.1.0
  • First R release.
  • itbnb() formula and matrix interfaces.
  • Tb-NB core: log-odds Bayes scoring with Laplace smoothing.
  • K-fold cross-validated threshold optimisation against 10 criteria.
  • iTb-NB iterative refinement with mode = "kde" or mode = "clt".
  • P-value extension introduced in Romano (2025, <doi:10.1007/978-3-031-96736-8_41>): tbnb_pvalues(fit, type = c("document", "feature"), method = c("clt", "kde")). summary(fit, pvalues = TRUE) lists the significant features.
  • Optional word-embedding semantic augmentation of the Bag-of-Words (tbnb_embedding() — *not* in the reference papers).
Show all changes in 0.1.0Hide the rest of the changes in 0.1.0
  • S3 methods: print, summary, predict, coef, plot.
  • Bundled toy dataset toy_reviews (200 short fictional hotel reviews).

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 3.1 min · r-oldrel-macos-x86_64
Status changes
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK7 OK2026-07-22
Advisories

none known

Documentation

In release 0.1.0
READMEYes · 369 wordsVignettesYes · 1 · dynamicNEWSYes · 67% structured · mentions 0.1.0Citation fileNoWebsitenot declared in DESCRIPTION
Help pages
17 (2 internal)includes a package overview page
Examples that run
0%3 only when donttest examples are enabled (R CMD check --as-cran)
Exported functions with examples
25%
Documented parameters
72%
Return-value docs
100%
Help pages citing references
29%

Downloads

685
CRAN downloads in the past year
Rank #18,463 · ~2/day · ~57/mo
Daily download trend is not available in this view yet.
23430 days
68590 days
6851 year
Compare downloads with other packages →
Also on18 r2u3 autocran

Dependencies

Declared dependencies
10 external dependencies (excludes base and recommended)

Installing tbnb adds 14 packages (11 with compiled code, 21 MB of source tarballs). Heaviest: stringi 11 MB, quanteda 4.2 MB, Rcpp 1.8 MB.

Depends (1)
R >= 4.0
Imports (6)
MatrixmethodsstatsgrDevicesgraphicsquanteda (>= 3.0.0)
LinkingTo (0)
none
Enhances (0)
none
Dependencies facing archival

CRAN will archive these unless their check problems are fixed by the date shown. This package needs each one to install.

Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (1)
Author, Maintainer since 0.1.0 (2026)
Releases (1)
  • 0.1.0Latest
    2026-07-21 · current release
  • R
    R 4.6.0 released · 2026-04-24

Package metadata

First published
2026-07-21
Total releases
1 / 1 yrs
License
GPL (>= 3) OSI
Minimum R
≥ 4.0
Bundled data
3.1 KB / 1 file
Download size
253 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("tbnb")
Romano, M. (2026). tbnb: Threshold-Based and Iterative Threshold-Based Naive Bayes Classifier (Version 0.1.0) [Computer software]. https://doi.org/10.32614/CRAN.package.tbnb

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for tbnb version 0.1.0 [Data set]. HJJB, LLC. Data release v2026-10-17. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-17, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy