<jupyter_start><jupyter_text>sweep patterns and plot error, density vs number of patterns stored<jupyter_code>import IPython.display as display
all_stats = []

error_fractions = []
densities = []

import sys
import time


for n_patterns in range(1000, 30000, 1000):
    print("n_patterns", n_patterns)
    sys.stdout.flush()


    stats, errors, alayer = e.test_store_recall(
        n_patterns=n_patterns, 
        n_clusters=8,
        cluster_size=256, 
        drop_fraction=.5,
        dtype='float32',
    #     ctx=mx.gpu(0)
    )
    
    # TODO: analyze errors at bit level, plot that also!
    
    all_stats.append(stats)
    
    error_fractions.append((n_patterns,stats['error_rate']))
    densities.append((n_patterns,stats['density']))
    
    display.clear_output(wait=True)      
    plt.clf()
    plt.plot(*zip(*error_fractions), label='error fractions')
    plt.plot(*zip(*densities), label='density')
    plt.legend()
    display.display(plt.gcf())
    time.sleep(.1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12573673870333987, 'fraction_numerical': 0.021611001964636542, 'mean_word_length': 3.3922413793103448, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '596870', 'license': 'MIT', 'n_tokens_mistral': 377, 'n_tokens_neox': 345, 'n_words': 62, 'path': 'multiplai/notebooks/structural_plasticity/clique_eval.ipynb', 'repo_name': 'dmacd/deep-neuroevolution', 'size': '1018'}