In [1]:
    
import os, sys
sys.path.insert(0, os.path.abspath(os.path.join("..", "..")))
    
In [2]:
    
%matplotlib inline
import matplotlib.pyplot as plt
import open_cp.scripted
import open_cp.scripted.analysis as analysis
    
In [3]:
    
betas = analysis.hit_counts_to_beta("pro_grid_opt.csv")
    
In [4]:
    
import re
def label(key):
    m = re.search("Classic\((.*?)\)", key)
    return m.group(1)
label(list(betas)[0])
    
    Out[4]:
In [5]:
    
fig, ax = plt.subplots(ncols=2, figsize=(16,7))
analysis.plot_betas(betas, ax[0])
ax[0].legend([])
analysis.plot_betas(betas, ax[1], plot_sds=False)
ax[1].legend([label(k) for k in betas])
    
    Out[5]:
    
In [6]:
    
fig, ax = plt.subplots(ncols=2, figsize=(16,7))
analysis.plot_betas(betas, ax[0], range(1, 21))
ax[0].legend([])
analysis.plot_betas(betas, ax[1], range(1, 21), plot_sds=False)
ax[1].legend([label(k) for k in betas])
    
    Out[6]:
    
In [7]:
    
fig, ax = plt.subplots(figsize=(12,6))
r = analysis.plot_betas_means_against_max(betas, ax, range(1,21))
    
    
In [8]:
    
{k : all(x>0.85 for x in r[k]) for k in r}
    
    Out[8]:
In [9]:
    
{k : sum(x>0.95 for x in r[k]) >= 16 for k in r}
    
    Out[9]:
In [10]:
    
highlight = {"sb=2, tb=9", "sb=4, tb=9"}
fig, ax = plt.subplots(figsize=(10,6))
x = list(range(1, 21))
for k in r:
    if label(k) not in highlight:
        ax.plot(x, r[k], color="black", label="_")
    else:
        ax.plot(x, r[k], label=label(k))
ax.legend()
None
    
    
In [12]:
    
betas = analysis.hit_counts_to_beta("pro_opt.csv")
    
In [13]:
    
fig, ax = plt.subplots(ncols=2, figsize=(16,7))
analysis.plot_betas(betas, ax[0])
ax[0].legend([])
analysis.plot_betas(betas, ax[1], plot_sds=False)
ax[1].legend([label(k) for k in betas])
    
    Out[13]:
    
In [14]:
    
fig, ax = plt.subplots(ncols=2, figsize=(16,7))
analysis.plot_betas(betas, ax[0], range(1, 21))
ax[0].legend([])
analysis.plot_betas(betas, ax[1], range(1, 21), plot_sds=False)
ax[1].legend([label(k) for k in betas])
    
    Out[14]:
    
In [15]:
    
fig, ax = plt.subplots(figsize=(12,6))
r = analysis.plot_betas_means_against_max(betas, ax, range(1,21))
    
    
In [19]:
    
{k : all(x>0.92 for x in r[k]) for k in r}
    
    Out[19]:
In [22]:
    
{k : sum(x>0.96 for x in r[k]) >= 16 for k in r}
    
    Out[22]:
In [25]:
    
highlight = {"sb=4, tb=7", "sb=3, tb=9"}
fig, ax = plt.subplots(figsize=(10,6))
x = list(range(1, 21))
for k in r:
    if label(k) not in highlight:
        ax.plot(x, r[k], color="black", label="_")
    else:
        ax.plot(x, r[k], label=label(k))
ax.legend()
None
    
    
In [ ]: