<jupyter_start><jupyter_text>[02/22/22] Runs with Random Labels<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pathlib import Path
import seaborn as sns
plt.style.use('default')
sns.set_theme(
    style='ticks',
    font_scale=1.2,
    rc={
        'axes.linewidth': '0.8',
        'axes.grid': True,
        'figure.constrained_layout.use': True,
        'grid.linewidth': '0.8',
        'legend.edgecolor': '1.0',
        'legend.fontsize': 'small',
        'legend.title_fontsize': 'small',
        'xtick.major.width': '0.8',
        'ytick.major.width': '0.8'
    },
)<jupyter_output><empty_output><jupyter_text>CIFAR-100 Results<jupyter_code>exp_name = 'cifar100-3200'

if exp_name == 'cifar100-6400':
    title_str = 'CIFAR-100, Random Subset 6400'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_ca0fca68956ec8882599f8bdc5ae9e3d/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_439ec583b4a27019478a6f7ff3564c09/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_a56e9fe2811c95f6a8e7211fa7308692/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_331b0df3a2e5fe1152d0833c205bf0ce/'), #  Rewind step 0
    ]  
elif exp_name == 'cifar100-3200':
    title_str = 'CIFAR-100, Random Subset 3200'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_442e7546dd44240465b55b0783bdb5e3/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_a1b5186263a31e2b4a4a9e8c5e758b28/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_2c787faf633ddc2997b72439573048c9/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_331b0df3a2e5fe1152d0833c205bf0ce/'), #  Rewind step 0
    ] 
elif exp_name == 'cifar100-2048':
    title_str = 'CIFAR-100, Random Subset 2048'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_38faf1033a261ef319e89251879c580b/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_618950e3c200c7b62d1bdf6da1d138ab/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_8e9adf71a779eb3259f34e9509e9f60b/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_331b0df3a2e5fe1152d0833c205bf0ce/'), #  Rewind step 0
    ] 
elif exp_name == 'cifar100-1024':
    title_str = 'CIFAR-100, Random Subset 1024'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_f0871ecf1b2f859179032ded9e21edb7/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_8efa45910b4e81f7899faba0818054e2/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_be4ac6a393b1a14760ac5d23cf0db400/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_331b0df3a2e5fe1152d0833c205bf0ce/'), #  Rewind step 0
    ]  
elif exp_name == 'cifar100-512':
    title_str = 'CIFAR-100, Random Subset 512'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_6c1cd9d70d6805dc7bc61864a05c4911/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_22039875879a6b0ef8ea2f68ce36eaef/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_f411501e532cc7f4a69b050a87b8964c/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_331b0df3a2e5fe1152d0833c205bf0ce/'), #  Rewind step 0
    ]  
elif exp_name == 'cifar100-256':
    title_str = 'CIFAR 100, Random Subset 256'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_15a8b3592f3b4f96875f976efc1861ba/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_0ea723c4400265f4c63a91c2b4591a51/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_c06b453384919ad0f3c2b85add287892/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_331b0df3a2e5fe1152d0833c205bf0ce/'), #  Rewind step 0
    ]
elif exp_name == 'cifar100-400it':
    title_str = 'CIFAR-100, All Data 400 It Baseline'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_885d0c007778485fd7dbb02762bbbdd9/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_11ee46aeddd5f32ee03e8c616ba7f7d8/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_3943e35bd994384410ae57483fa41154/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_331b0df3a2e5fe1152d0833c205bf0ce/'), #  Rewind step 0
    ]
elif exp_name == 'cifar100-800it':
    title_str = 'CIFAR-100, All Data 800 It Baseline'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_52ca7fa2fd4d90921b2172043ecc550b/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_343eeba38e75195a6af760dc155cf219/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_5f6f92f77609665d103abeec69aa1041/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_331b0df3a2e5fe1152d0833c205bf0ce/'), #  Rewind step 0
    ]
    

exp_paths = [[emp / f'replicate_{i}' for i in range(1, 5)] for emp in exp_meta_paths]

plt.figure(figsize=(8.4, 4.8))
ls = []

for i, eps in enumerate(exp_paths):
    num_levels = 20
    acc_run_level = []
    for p in eps:
        acc_level = []
        for l in range(num_levels + 1):
            df = pd.read_csv(p / f'level_{l}/main/logger', header=None)
            acc_level.append(df[2].iloc[-2])
        acc_run_level.append(acc_level)
    acc_run_level = np.array(acc_run_level)
    x = np.arange(21)
    ys = acc_run_level
    y_mean, y_std = ys.mean(0), ys.std(0)
    c = f'C{i}'
    l = plt.plot(x, y_mean, c=c, alpha=0.8, linewidth=2)
    ls.append(l[0])
    plt.fill_between(x, y_mean + y_std, y_mean - y_std, color=c, alpha=0.2)

plt.legend(
    ls, 
    [   
        'True Data',
        '10% Randomized Labels',
        '50% Randomized Labels',
        'Rewind step 0',
        # '8 Passes, 6400 Random Examples, 400 Steps',
        # '16 Passes, 3200 Random Examples, 400 Steps',
        # '40 Passes, 1280 Random Examples, 400 Steps',
    ],
)
plt.xlim(0, 15)
plt.ylim(0.52, 0.70)
plt.xticks(np.arange(0, 16, 2), [f'{f*100:.1f}' for f in 0.8**np.arange(0, 16, 2)])
plt.xlabel('% Weights Remaining')
plt.ylabel('Test Accuracy')
plt.title(title_str)
sns.despine()
#plt.savefig('/home/mansheej/open_lth/figs/0021.svg')
plt.show()<jupyter_output><empty_output><jupyter_text>CIFAR-10 Results<jupyter_code>exp_name = 'cifar10-2048'

if exp_name == 'cifar10-12800':
    title_str = 'CIFAR-10, Random Subset 12800'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_bf2043aad2f023216233900c400770ba/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_ad407d504ff1044031a8f0810f238765/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_016261b2c5fa7e410b2bdb4e72b5cc00/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_93bc65d66dfa64ffaf2a0ab105433a2c/'), #  Rewind step 0
    ]
elif exp_name == 'cifar10-6400':
    title_str = 'CIFAR-10, Random Subset 6400'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_a254f668536d96cf8b7efe57b42c820e/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_d5f0041b70fd6a3312234e5091c51805/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_fb43bbbc90ca2b0c87e79a9bc1661bde/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_93bc65d66dfa64ffaf2a0ab105433a2c/'), #  Rewind step 0
    ]  
elif exp_name == 'cifar10-3200':
    title_str = 'CIFAR-10, Random Subset 3200'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_ba63d4e87a47b6510802250ca426c2c8/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_83934fbfb101b40393e8e4ac4f17680c/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_9c87bc73566ac1470ea6fcf0270bebd3/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_93bc65d66dfa64ffaf2a0ab105433a2c/'), #  Rewind step 0
    ] 
elif exp_name == 'cifar10-2048':
    title_str = 'CIFAR-10, Random Subset 2048'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_2b254e722dfa65d5deb4c9f92b95ae24/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_b0424729f1404f1a3def6fd7016830ee/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_6bd9875de0e81deadf881348a883f207/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_93bc65d66dfa64ffaf2a0ab105433a2c/'), #  Rewind step 0
    ] 
elif exp_name == 'cifar10-1024':
    title_str = 'CIFAR-10, Random Subset 1024'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_21b482dfef13693a8c7a2a1387d5b0d6/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_ed2594232afc90888a296e52a2c538dd/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_3bd3e549d2395564d5083cd4dfc9e244/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_93bc65d66dfa64ffaf2a0ab105433a2c/'), #  Rewind step 0
    ]  
elif exp_name == 'cifar10-512':
    title_str = 'CIFAR-10, Random Subset 512'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_25e96656cceec2ce346d70a1ec5b0b91/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_51ca10929451b1500e684beba3072b48/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_5f7a5bb37ce083881b7ec602423c42b1/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_93bc65d66dfa64ffaf2a0ab105433a2c/'), #  Rewind step 0
    ]  
elif exp_name == 'cifar10-256':
    title_str = 'CIFAR-10, Random Subset 256'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_f756dc9ae7bb6af7feed1220683eadf2/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_a073c1f148faf69f16c05dae27c5b024/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_723cc0343fa9759d6f09cc5a7fd05788/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_93bc65d66dfa64ffaf2a0ab105433a2c/'), #  Rewind step 0
    ]
elif exp_name == 'cifar10-200it':
    title_str = 'CIFAR-10, All Data 200 It Baseline'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_cde7759c37afd06089e40079be402d85/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_26e74ee125a5237c384f225fe5d6f95c/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_e3f260eada2eabd9a648568b12ef72c1/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_93bc65d66dfa64ffaf2a0ab105433a2c/'), #  Rewind step 0
    ]
elif exp_name == 'cifar10-400it':
    title_str = 'CIFAR-10, All Data 400 It Baseline'
    exp_meta_paths = [
        Path(f'/home/brettlarsen/open_lth_data/lottery_c8581cb588b61218e694360133c23fd5/'), #  True Data
        Path(f'/home/brettlarsen/open_lth_data/lottery_5a518568a01725b07b90c9bac8bf1b6a/'), #  10% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_ba07e60da69de10f5594e1bec03ad667/'), #  50% randomized labels
        Path(f'/home/brettlarsen/open_lth_data/lottery_93bc65d66dfa64ffaf2a0ab105433a2c/'), #  Rewind step 0
    ]
    

exp_paths = [[emp / f'replicate_{i}' for i in range(1, 5)] for emp in exp_meta_paths]

plt.figure(figsize=(8.4, 4.8))
ls = []

for i, eps in enumerate(exp_paths):
    num_levels = 20
    acc_run_level = []
    for p in eps:
        acc_level = []
        for l in range(num_levels + 1):
            df = pd.read_csv(p / f'level_{l}/main/logger', header=None)
            acc_level.append(df[2].iloc[-2])
        acc_run_level.append(acc_level)
    acc_run_level = np.array(acc_run_level)
    x = np.arange(21)
    ys = acc_run_level
    y_mean, y_std = ys.mean(0), ys.std(0)
    c = f'C{i}'
    l = plt.plot(x, y_mean, c=c, alpha=0.8, linewidth=2)
    ls.append(l[0])
    plt.fill_between(x, y_mean + y_std, y_mean - y_std, color=c, alpha=0.2)

plt.legend(
    ls, 
    [   
        'True Data',
        '10% Randomized Labels',
        '50% Randomized Labels',
        'Rewind step 0',
        # '8 Passes, 6400 Random Examples, 400 Steps',
        # '16 Passes, 3200 Random Examples, 400 Steps',
        # '40 Passes, 1280 Random Examples, 400 Steps',
    ],
)
plt.xlim(0, 15)
plt.ylim(0.82, 0.92)
plt.xticks(np.arange(0, 16, 2), [f'{f*100:.1f}' for f in 0.8**np.arange(0, 16, 2)])
plt.xlabel('% Weights Remaining')
plt.ylabel('Test Accuracy')
plt.title(title_str)
sns.despine()
#plt.savefig('/home/mansheej/open_lth/figs/0021.svg')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12211170619739863, 'fraction_numerical': 0.1403213465952563, 'mean_word_length': 3.8808812546676625, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '47303', 'license': 'MIT', 'n_tokens_mistral': 6787, 'n_tokens_neox': 5664, 'n_words': 713, 'path': 'nbs/22_02_22_Checking_Random_Labels.ipynb', 'repo_name': 'mansheej/open_lth', 'size': '13070'}