<jupyter_start><jupyter_text>Instantiate class.<jupyter_code>pca = PCA(num_rows=10, num_cols=3, use_sample_covariance=True, top_k_pc=2)<jupyter_output><empty_output><jupyter_text>Calculate data statistics.<jupyter_code>pca.calculate_eigenvalues_and_eigenvectors(data=data)
pca.col_mean_vector
pca.covariance_matrix
pca.eigenvalues
pca.eigenvectors<jupyter_output><empty_output><jupyter_text>Projection<jupyter_code>pca.pca_projection_to_top_k_pc(data=data)
pca.top_k_eigenvectors<jupyter_output><empty_output><jupyter_text>Reconstruction.<jupyter_code>recon = pca.pca_reconstruction_from_top_k_pc(data=data)
recon<jupyter_output><empty_output><jupyter_text>MSE<jupyter_code>(np.sum((data - recon)**2) / data.shape[0]) * (data.shape[0] / (data.shape[0] - 1))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12706480304955528, 'fraction_numerical': 0.011435832274459974, 'mean_word_length': 16.130434782608695, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '413536', 'license': 'Apache-2.0', 'n_tokens_mistral': 346, 'n_tokens_neox': 335, 'n_words': 20, 'path': 'machine_learning/dimensionality_reduction/pca/tf_pca/tf_pca_in_core.ipynb', 'repo_name': 'ryangillard/artificial_intelligence', 'size': '787'}