<jupyter_start><jupyter_text>Interpolating missing data with probabalistic PCAWhen you pass a matrix with with missing data, hypertools will attempt tofill in the values using probabalistic principal components analysis (PPCA).Here is an example where we generate some synthetic data, remove some of thevalues, and then use PPCA to interpolate those missing values. Then, we plotboth the original and data with missing values together to see how it performed.<jupyter_code># Code source: <NAME>
# License: MIT

# import
from scipy.linalg import toeplitz
import numpy as np
from copy import copy
import hypertools as hyp

# simulate data
K = 10 - toeplitz(np.arange(10))
data1 = np.cumsum(np.random.multivariate_normal(np.zeros(10), K, 250), axis=0)
data2 = copy(data1)

# simulate missing data
missing = .1
inds = [(i,j) for i in range(data2.shape[0]) for j in range(data2.shape[1])]
missing_data = [inds[i] for i in np.random.choice(int(len(inds)), int(len(inds)*missing))]
for i,j in missing_data:
    data2[i,j]=np.nan

# plot
hyp.plot([data1, data2], linestyle=['-',':'], legend=['Original', 'PPCA'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11022927689594356, 'fraction_numerical': 0.018518518518518517, 'mean_word_length': 5.676470588235294, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '609913', 'license': 'MIT', 'n_tokens_mistral': 388, 'n_tokens_neox': 368, 'n_words': 132, 'path': 'docs/auto_examples/plot_PPCA.ipynb', 'repo_name': 'timgates42/hypertools', 'size': '1142'}