<jupyter_start><jupyter_text>Example CP-APR with Dense Numpy Tensor<jupyter_code>import scipy.io as spio
import numpy as np<jupyter_output><empty_output><jupyter_text>Create a order 3 tensor with random count values:<jupyter_code>X = np.arange(1, 12001).reshape([10,30,40])
X<jupyter_output><empty_output><jupyter_text>Initilize CP-APR:<jupyter_code>from pyCP_APR import CP_APR

cp_apr = CP_APR(n_iters=100, simple_verbose=True, method='numpy')<jupyter_output><empty_output><jupyter_text>Take the CP-APR decomposition:<jupyter_code>result = cp_apr.fit(tensor=X, Type='tensor', rank=2)
result.keys()
M = result['Factors']
Gamma = result['Weights']

M_0 = M['0']
Gamma_0 = Gamma[0]

print('Component 0:\n', M_0, '\nGamma 0:', Gamma_0)<jupyter_output>Component 0:
 [[2.74415558e-02 8.77862465e-27]
 [8.22789695e-02 2.44572417e-07]
 [1.37116383e-01 2.63674838e-04]
 [1.91953797e-01 5.12487655e-03]
 [2.46791211e-01 2.75458393e-02]
 [3.01628625e-01 8.23806649e-02]
 [3.56466038e-01 1.80843345e-01]
 [4.11303452e-01 3.26753896e-01]
 [4.66140866e-01 5.21119331e-01]
 [5.20978280e-01 7.62489697e-01]] 
Gamma 0: 11385169.326804055
{'fraction_non_alphanumeric': 0.15254237288135594, 'fraction_numerical': 0.23550401427297057, 'mean_word_length': 6.530201342281879, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '12630', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 675, 'n_tokens_neox': 526, 'n_words': 77, 'path': 'examples/CP-APR_Numpy_Dense.ipynb', 'repo_name': 'lanl/pyCP_APR', 'size': '1121'}