|
libtma 0.3.13-dev.9013
QE C++ library
|
Accumulation primitives shared between the rENA stanza-window model and the tma ground/response/tensor model. More...
#include <algorithm>#include <armadillo>#include <cctype>#include <cmath>#include <functional>#include <stdexcept>#include <string>#include <vector>#include <libqe/adjacency.hpp>Go to the source code of this file.
Classes | |
| struct | qe::UnitNetworks |
| Result of accumulate_unit_with_rows(). More... | |
| struct | qe::TensorNetworks |
| Result of apply_tensor_unit(). More... | |
| struct | qe::UnitAccumulation |
| Result of accumulate_unit_networks(): a unit's finished vectors plus its raw per-line rows. More... | |
Namespaces | |
| namespace | qe |
Functions | |
| arma::mat | qe::finalize_row_connections (const arma::mat &row_conn, int n_codes, bool ordered, WeightModel weight, bool diagonal=false) |
| Finalise each per-response-row tensor connection vector. | |
| arma::rowvec | qe::aggregate_row_connections (const arma::mat &row_conn, int n_codes, bool ordered, WeightModel weight, bool diagonal=false) |
| Aggregate per-response-row tensor connections into a unit vector. | |
| arma::rowvec | qe::aggregate_row_connections (const arma::mat &row_conn, int n_codes, bool ordered=false, bool binary=true) |
Legacy form: binary selects Binary (true) or Product (false). | |
| arma::mat | qe::finalize_self_connections (const arma::mat &row_conn, int n_codes, bool ordered, WeightModel weight) |
| Per-line self-connections: the diagonal of each directed row. | |
| arma::rowvec | qe::aggregate_self_connections (const arma::mat &row_conn, int n_codes, bool ordered, WeightModel weight) |
| Unit self-connection vector: finalize_self_connections() summed over the lines. | |
| arma::mat | qe::weight_rows (const arma::mat &rows, bool ordered, WeightModel weight) |
| Apply the weight model per line to already-finalised rows. | |
Core adjacency math | |
| arma::mat | qe::connection_matrix (arma::rowvec ground, arma::rowvec response, double response_weight=1.0, bool ordered=true) |
| Compute the connection matrix for one ground + response event pair. | |
Traditional stanza-window accumulation (rENA model) | |
| arma::mat | qe::accumulate_stanza (arma::mat codes, int window_back=1, int window_forward=0, bool binary=true, bool ordered=false) |
| Accumulate connection vectors for every row in one conversation using a stanza window. | |
Ground/response accumulation (tma model) | |
| arma::rowvec | qe::accumulate_unit (const arma::mat &codes, const std::vector< int > &unit_rows, std::function< arma::vec(arma::vec)> decay_fn, bool ordered=false) |
| Accumulate connections for a single unit from its context rows. | |
Extended ground/response accumulation — returns per-row connection data | |
| UnitNetworks | qe::accumulate_unit_with_rows (const arma::mat &codes, const std::vector< int > &unit_rows, std::function< arma::vec(int, arma::uvec)> decay_fn, bool ordered=false) |
Like accumulate_unit() but also returns the per-response-row connection matrix needed by tma's accumulate_network(). | |
Tensor-based multi-modal accumulation (tma model) | |
| int | qe::flat_index (const std::vector< int > &indices, const std::vector< int > &dims) |
| Compute the linear index into a column-major multi-dimensional array. | |
| arma::mat | qe::miss_matrix (const arma::rowvec &ground, const arma::rowvec &response) |
| Missed co-occurrences for one ground + response event pair. | |
| TensorNetworks | qe::apply_tensor_unit (const arma::vec &tensor, const std::vector< int > &dims, const std::vector< int > &dims_sender, const std::vector< int > &dims_receiver, const std::vector< int > &dims_mode, const arma::imat &context_lookup, const std::vector< int > &unit_rows, const arma::mat &codes, const arma::vec ×, bool ordered=true, bool return_members=false, bool return_misses=false) |
Pure-C++ port of the tma apply_tensor() inner logic. | |
Finished unit networks (one call per unit, for every binding) | |
| UnitAccumulation | qe::accumulate_unit_networks (const arma::vec &tensor, const std::vector< int > &dims, const std::vector< int > &dims_sender, const std::vector< int > &dims_receiver, const std::vector< int > &dims_mode, const arma::imat &context_lookup, const std::vector< int > &unit_rows, const arma::mat &codes, const arma::vec ×, bool ordered=false, WeightModel weight=WeightModel::Binary, bool misses=true, bool diagonal=false) |
| Accumulate one unit's networks end to end. | |
Per-row co-occurrence and rolling window (rENA accumulation primitives) | |
| arma::mat | qe::row_connections (const arma::mat &codes, bool binary=true) |
| Compute the upper-triangle co-occurrence vector for each row. | |
| arma::mat | qe::rolling_window_sum (const arma::mat &codes, int window_size=1) |
| Rolling backward window sum of the raw code matrix. | |
Weight models (per-line co-occurrence transforms, = rENA's weight.by) | |
| enum class | qe::WeightModel { qe::Binary , qe::Product , qe::Sqrt , qe::Log1p } |
| Transform applied to each line's connection counts before the per-unit sum. More... | |
| WeightModel | qe::weight_model_from_string (const std::string &name) |
| Parse a weight-model name (case-insensitive). | |
| WeightModel | qe::weight_model_from_bool (bool binary) |
Map the legacy binary flag to a weight model (true → Binary, false → Product). | |
| void | qe::apply_weight_model (arma::rowvec &v, WeightModel weight, bool ordered) |
| Apply a weight model in place to one line's connection vector. | |
Accumulation primitives shared between the rENA stanza-window model and the tma ground/response/tensor model.
Both models reduce to the same core connection_matrix() operation; they differ in how ground and response vectors are assembled from the raw data.