<jupyter_start><jupyter_text>NOT USED<jupyter_code>stan_time = pickle.load(open("C:\\Users\\ymamo\\Google Drive\\1. PhD\\Dissertation\\SugarScape\\NetScape_Standard\\Time_stats.p", "rb"))
brute_time = pickle.load(open("C:\\Users\\ymamo\\Google Drive\\1. PhD\\Dissertation\\SugarScape\\NetScape_Brute\\Time_stats.p", "rb"))
net_time = pickle.load(open("net_multi_time.p", "rb"))
stan_time.head()


from statistics import mean
def time_summary(df): 
    net_by_100 = []
    net_x = []
    net_temp = []
    idx = 100
    total = 0
    for k,v in df.iterrows(): 

        if k % idx != 0 or k == 0: 
            net_temp.append(v["Time Per Step"])
            total += v["Time Per Step"]
        else: 
            net_x.append(idx)
            net_by_100.append(mean(net_temp))
            net_temp = []
            idx += 100
            net_temp.append(v["Time Per Step"])
            total += v["Time Per Step"]
    return net_by_100, net_x, round(total,2)
net_100, net_x, total_n = time_summary(net_time)
stan_100, stan_x, total_s = time_summary(stan_time)
brute_100, brute_x, total_b = time_summary(brute_time)
fig4, ax4 = plt.subplots(figsize=(7,7))
plt.plot(net_x, net_100, label = "Network Approach")
plt.plot(stan_x, stan_100, label = "Standard Approach")
plt.plot(brute_x, brute_100, label = "Explicit Approach")
plt.text(660, .075, "Network Total: "+str(total_n) +"\nStandard Time: "+str(total_s) + "\nExplicit Approach: "+str(total_b))
#plt.scatter(brute_time.index.values, stan_time["Time Per Step"])
plt.legend()
plt.title("Typical Time Result Between Approaches", fontsize= 15, fontweight = "bold")

def smooth_time(sur,time,group_size):
    survivors = zip(*(iter(sur),) * group_size)
    timey = zip(*(iter(time),) * group_size)
    sur = []
    tim = []
    for s in survivors:
        sur.append(mean(s))
    for t in timey: 
        tim.append(mean(t))
    return sur, tim

net_s, net_t = smooth_time(net_multi_s, net_multi_t, 10)
brut_s, brut_t = smooth_time(brute_multi_s, brute_multi_t, 10)
stan_s, stan_t = smooth_time(stan_multi_s, stan_multi_t, 10)
fig5, ax5 = plt.subplots(figsize=(7,7))
plt.plot(list(range(10)), net_s, label = "Network Approach")
plt.plot(list(range(10)), stan_s, label = "Standard Approach")
plt.plot(list(range(10)), brut_s, label = "Explicit Approach")
plt.legend()
plt.title("Survivors 100 Runs", fontsize= 15, fontweight = "bold")

fig5, ax5 = plt.subplots(figsize=(7,7))
plt.plot(list(range(10)), net_t, label = "Network Approach")
plt.plot(list(range(10)), stan_t, label = "Standard Approach")
plt.plot(list(range(10)), brut_t, label = "Explicit Approach")
plt.legend()
plt.title("Time 100 Runs", fontsize= 15, fontweight = "bold")
#plt.text(75, 70, "Network Mean: "+str(net_mean) +"\nStandard Time: "+str(stan_mean) + "\nExplicit Approach: "+str(brute_mean))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16338028169014085, 'fraction_numerical': 0.03204225352112676, 'mean_word_length': 4.261111111111111, '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': '500076', 'license': 'MIT', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1063, 'n_words': 219, 'path': 'Policy-Network/.ipynb_checkpoints/Data Analysis-checkpoint.ipynb', 'repo_name': 'mahdijo6731/SugarScape', 'size': '2840'}