Skip to content

Releases: maximtrp/tmplot

tmplot: v0.5.0

Choose a tag to compare

@maximtrp maximtrp released this 29 Aug 07:40
5c25ca4

Breaking Changes

  • HDP dead topics dropped. get_phi() / get_theta() return only live topics for tomotopy HDPModel. Fewer topics than before, and columns/index now carry the model's own ids (e.g. [6, 8, 24, 25]) instead of 0..k-1. Warns when dropping. Other model types unaffected.
  • bitermplus >= 1.0 required. p(z|d) is no longer stored on BTM, so get_theta() needs the documents: get_theta(model, corpus=get_vectorized_docs(docs, vocab)). BTMClassifier needs no corpus.
  • entropy() raises for a single topic. Rényi entropy is undefined at T=1 (q = 1/T = 1 zeroes the F/(q-1) denominator). Previously returned an arbitrary fallback. Matches bitermplus 1.0.
  • get_closest_topics() rejects out-of-range or negative ref instead of silently clamping; empty model list errors.
  • get_stable_topics() validates array shapes and ref.

New Features

  • entropy() accepts either orientation. W×T (as get_phi returns) or T×W, inferred from which axis sums to 1. New topics_axis argument states it explicitly; a value contradicting the data now errors instead of returning a wrong number.
  • BTMClassifier support, end to end — get_phi, get_theta, prepare_coords, report.
  • prepare_coords() accepts precomputed phi / theta.

Bug Fixes

  • entropy() silently returned wrong numbers for a transposed matrix — 1.1625 vs the correct 0.7272 on one 40×30 phi, with no error. It selects the topic count, so this could change published conclusions.
  • Dead HDP topics corrupted everything downstream — entropy 0.0995 where the true value was 1.5524.
  • lle / ltsa crashed on collapsed topic distances ("output dimension must be less than or equal to input dimension").
  • An HDP model with no live topics returned an empty phi; now raises.
  • Jaccard top_words=0 raised ZeroDivisionError; negative values silently returned wrong distances.
  • report() failed when docs was a NumPy array.
  • Selected topic was not highlighted when using a custom topic_col.
  • Duplicate word labels pushed genuine terms out of calc_terms_probs_ratio().
  • get_top_docs() gave an opaque IndexError for an out-of-range topic.
  • _is_btm_classifier() returned None instead of False.
  • get_closest_topics() validated method only after loading the reference model.

Performance

Distances are computed on whole matrices instead of looping over topic pairs; Jaccard sorts once per topic rather than once per pair. Results unchanged — identical for Jaccard, below 1e-13 elsewhere.

5000 words × 50 topics Before After
get_topics_dist (sklb) 0.21 s 0.005 s
get_topics_dist (jac) 1.00 s 0.031 s
get_closest_topics (sklb) 1.86 s 0.021 s
get_closest_topics (jac) 6.13 s 0.096 s

report() now reads phi and theta once each instead of up to five times.

Compatibility

  • scikit-learn 1.4 through 1.9+. MDS takes dissimilarity before 1.9 and metric from 1.9; both branches are tested, and CI runs the declared floor (1.4.2).
  • entropy() matches bitermplus.entropy numerically at default settings. Note the flag is named in opposite directions: tmplot max_probs=False == bitermplus max_probs=True.
  • CI matrix gained Python 3.11; package classifiers gained 3.13.

Internal

  • Tests 102 → 257; line coverage 93% → 99%.

tmplot: v0.4.0

Choose a tag to compare

@maximtrp maximtrp released this 26 Aug 20:22
  • Fixed Jaccard topic matching and KL/Jeffrey divergence calculations.
  • Corrected topic-distance embeddings and two-topic model handling.
  • Improved comparisons across models with different vocabularies or topic counts.
  • Fixed prevalence-weighted term probabilities and relevance rankings.
  • Vectorized saliency calculations and optimized top-document selection.
  • Strengthened input validation and optional model adapter handling.
  • Improved interactive report reliability and caching.
  • Added extensive regression coverage: 102 tests passing with 92% coverage.
  • Added Python 3.9–3.14 CI and built-package validation.

tmplot: v0.3.0

Choose a tag to compare

@maximtrp maximtrp released this 13 Sep 11:13
  • Fixed Jensen-Shannon and symmetric Kullback-Leibler divergence calculation (was using incorrect formulas)
  • Fixed variable name bug in report interface
  • Fixed sklearn MDS FutureWarning
  • Added comprehensive input validation for probability matrices
  • Cached phi matrix calculations to reduce redundant calls
  • Added error handling for edge cases (division by zero, log(0))
  • Added bounds checking and empty data validation
  • Improved numerical stability with named constants
  • Enhanced error messages for better debugging

tmplot: v0.2.0

Choose a tag to compare

@maximtrp maximtrp released this 15 Mar 23:11

This release fixed issues in marginal distribution and saliency calculations.

tmplot: v0.1.3

Choose a tag to compare

@maximtrp maximtrp released this 19 Sep 13:28
17acb8b

This release fixes a number of bugs in report method and slightly improves type hinting (thanks to @Nfsaavedra and @franciee2): #11, #13

tmplot: v0.1.2

Choose a tag to compare

@maximtrp maximtrp released this 26 Jan 08:31
6efa380

This release fixes relevance calculation (#10, thanks to @ed9w2in6) and improves entropy test.

tmplot: v0.1.1

Choose a tag to compare

@maximtrp maximtrp released this 27 Oct 20:31

This release fixes the lower bound error in TSNE perplexity setting (#6, #9, thanks to @caicai555, @Yif18). It also includes minor code and package improvements.

tmplot: v0.1.0

Choose a tag to compare

@maximtrp maximtrp released this 17 May 19:34
d8de89f

This release fixes an error in get_phi method, adds some basic tests (to be added more in future), and updates packaging configs.

tmplot: v0.0.10

Choose a tag to compare

@maximtrp maximtrp released this 22 Oct 06:31

This release introduces improvements to entropy calculation method.

tmplot: v0.0.9

Choose a tag to compare

@maximtrp maximtrp released this 20 Aug 10:42

This release fixes a bug in topic scatter plot (#6) and optimizes t-SNE parameters for calculating topics 2D coordinates for scatter plot. It also includes minor cosmetic changes and fixes.