<jupyter_start><jupyter_text>notes* Given: a matrix $A \in \mathbb{Z}_0^{n \times d}$, a distance metric $D$, and an integer $k << d$.* Goal: learn a mapping $f: \mathbb{Z}_0^d \longrightarrow \mathbb{R}_0^k$ such that the<jupyter_code># valid_data = Dataset(which='valid')

# included_users = np.random.choice(
#     len(valid_data), replace=False, size=200
# ).astype(int)

# A = create_occurrence_matrix(
#     valid_data, included_users, include_play_counts=False
# )

# U, s, Vt = sps.linalg.svds(A.astype('float32'), k=180)<jupyter_output><empty_output><jupyter_text>model<jupyter_code>class BaggingSVDKNN(object):
    
    def __init__(
        self, num_predictors=100, subset_size=1000, reduced_dim=100
    ):
        self.num_predictors = num_predictors
        self.subset_size    = subset_size
        self.reduced_dim    = reduced_dim
        
        self.data_subsets = None
        self.matrices     = None
        self.predictors   = None
    
    def fit(self, train_data):
        self.data_subsets = []
        self.matrices     = []
        self.predictors   = []
        
        subset_indices = []
        for _ in range(self.num_predictors):
            idx = np.random.choice(
                len(train_data), replace=False, size=self.subset_size
            )
            X = create_occurrence_matrix(train_data, idx)
            
            break
    
model = BaggingSVDKNN()
train_data = Dataset(which='train')
model.fit(train_data)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11796246648793565, 'fraction_numerical': 0.014075067024128687, 'mean_word_length': 2.751256281407035, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '452283', 'license': 'MIT', 'n_tokens_mistral': 525, 'n_tokens_neox': 505, 'n_words': 90, 'path': 'notebooks/Collaborative-Filtering-Exploration.ipynb', 'repo_name': 'zimmerman-cole/music-recommendation', 'size': '1492'}