{'fraction_non_alphanumeric': 0.031205673758865248, 'fraction_numerical': 0.011347517730496455, 'mean_word_length': 5.788461538461538, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Fast manipulation of multi-dimensional arrays in Matlab

Probabilistic inference in graphical models with discrete random variables requires performing various operations on multi-dimensional arrays (discrete potentials). This is true whether we use an exact algorithm like junction tree [CDLS99, HD96] or an approximate algorithm like loopy belief propagation [AM00, KFL01]. These operations consist of element-wise multiplication/division of two arrays of potentially different sizes, and summation (marginalization) over a subset of the dimensions. This report discusses efficient ways to implement these operations in Matlab, with an emphasis on the implementation used in the Bayes Net Toolbox (BNT).