libqe 0.2.6-dev.9001
QE C++ library
Loading...
Searching...
No Matches
nesting.hpp File Reference

Nested-code candidates from a binary code matrix: which codes are contained in which, by co-occurrence on the coded lines. More...

#include <armadillo>
#include <cmath>
#include <stdexcept>
#include <vector>

Go to the source code of this file.

Classes

struct  qe::NestingCandidates
 Result of nesting_candidates(). All indices are 0-based code columns. More...
 

Namespaces

namespace  qe
 

Functions

NestingCandidates qe::nesting_candidates (const arma::mat &codes, double threshold=0.95, int min_rows=5)
 Pairs of codes where one is (nearly) always coded with another.
 

Detailed Description

Nested-code candidates from a binary code matrix: which codes are contained in which, by co-occurrence on the coded lines.

A nested code (B under A) is one that, when it is coded, is coded on a line that also carries A. Before accumulation the parent is split into its subcodes plus a residual (A without any subcode) and the family's connections are masked; that is a data transformation shared by every model (ENA, ONA, TMA), so the detection lives here, not in libena.

This header holds only the numeric signal: per-code line counts, pairwise co-occurrence, the pairs whose containment reaches a threshold, and the pairs with identical presence (duplicates, never nested). Signals from a codebook hierarchy or from code names belong to the caller.

Pure C++ / Armadillo — no Rcpp dependency.