extract_individuals



In [2]:
%cd /Users/balandat/Documents/Code/eclipse workspace/cont_no_regret
import ContNoRegret
from ContNoRegret.utils import plot_loglogs, plot_snapshots, plot_results
from ContNoRegret.animate import save_animations
import matplotlib
import matplotlib.pyplot as plt
import pickle
import os


/Users/balandat/Documents/Code/eclipse workspace/cont_no_regret

Comparison of Exp, pExp and ExpP


In [17]:
folder = '/Users/balandat/Documents/Code/Continuous_No-Regret/results/'
file = '2015-05-25_21-35/NIPS2_CNR_pexp_comparison_Quadratic.piggl'
with open(folder+file, 'rb') as f:
    results = pickle.load(f)
results = {r.label : r for r in results}
print(list(results.keys()))


['Greedy']

In [13]:
results = [{key:res for key,res in results.items() if 'p={1.25}' in key},
           {key:res for key,res in results.items() if 'p={1.5}' in key},
           {key:res for key,res in results.items() if 'p={1.75}' in key}]

In [16]:
plot_u0s([{key:res for key,res in results[2].items() if 'pExpPot' in key},
          {key:res for key,res in results[2].items() if 'ExpPPot' in key}])

In [22]:
plot_u0s([results], bounds=False)

Effect of the bounds on the norms


In [3]:
folder = '/Users/balandat/Documents/Code/Continuous_No-Regret/results/2015-05-27_11-48/'
file = 'NIPS2_CNR_PolyNormBounds_Polynomial.piggl'
with open(folder+file, 'rb') as f:
    results = pickle.load(f)
results = {r.label : r for r in results}
print(list(results.keys()))


['norm_pExpPot, $p={2}, gamma={1}$', 'norm_pNormPot, $p={1.05}$', 'norm_ExpPot']

In [4]:
plot_loglogs([results], directory=None)

Effect of the dimension n


In [15]:
folder = '/Users/balandat/Documents/Code/Continuous_No-Regret/individ_results/dimension'
pots = ['ExpPot', 'pNormPot', 'FTAL', 'OGD', 'ONS', 'GP', 'EWOO']
results = {pot:[] for pot in pots}
for pot in pots:
    for filename in os.listdir(folder):
        if pot in filename:
            with open('{}/{}'.format(folder, filename), 'rb') as f:
                res = pickle.load(f)
                res.label = filename.strip('piggl')
                results[pot].append(res)

In [16]:
plot_results(results['pNormPot'])


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-16-e610e657ac98> in <module>()
----> 1 plot_results(results['pNormPot'])

NameError: name 'plot_results' is not defined

In [48]:
dd = results['ExpPot'][0].regs_norate['tsavg'][0] / results['ExpPot'][1].regs_norate['tsavg'][0]

In [49]:
import matplotlib.pyplot as plt
plt.plot(dd)


Out[49]:
[<matplotlib.lines.Line2D at 0x11f663f28>]

Effect of the uniform fatness parameter v


In [9]:
folder = '/Users/balandat/Documents/Code/Continuous_No-Regret/results/2015-05-27_08-36/'
file = 'NIPS2_CNR_vs_Quadratic.piggl'
with open(folder+file, 'rb') as f:
    results = pickle.load(f)
results = {r.label : r for r in results}
print(list(results.keys()))


['v=0.10, pNormPot, $p={1.75}$', 'v=0.05, pExpPot, $p={1.5}, gamma={1}$', 'v=0.50, ExpPot', 'v=0.05, pNormPot, $p={1.75}$', 'v=0.25, pExpPot, $p={1.5}, gamma={4}$', 'v=0.10, pNormPot, $p={1.05}$', 'v=0.25, ExpPot', 'v=0.50, pExpPot, $p={1.5}, gamma={4}$', 'v=0.05, ExpPot', 'v=0.50, pNormPot, $p={1.05}$', 'v=0.05, pNormPot, $p={1.05}$', 'v=0.10, pExpPot, $p={1.5}, gamma={4}$', 'v=0.25, pNormPot, $p={1.05}$', 'v=1.00, pExpPot, $p={1.5}, gamma={1}$', 'v=0.05, pNormPot, $p={1.5}$', 'v=1.00, pExpPot, $p={1.5}, gamma={4}$', 'v=0.25, pExpPot, $p={1.5}, gamma={1}$', 'v=1.00, ExpPot', 'v=0.25, pNormPot, $p={1.75}$', 'v=0.50, pNormPot, $p={1.5}$', 'v=0.25, pNormPot, $p={1.5}$', 'v=1.00, pNormPot, $p={1.05}$', 'v=1.00, pNormPot, $p={1.5}$', 'v=0.50, pExpPot, $p={1.5}, gamma={1}$', 'v=0.10, ExpPot', 'v=0.10, pExpPot, $p={1.5}, gamma={1}$', 'v=0.05, pExpPot, $p={1.5}, gamma={4}$', 'v=0.50, pNormPot, $p={1.75}$', 'v=1.00, pNormPot, $p={1.75}$', 'v=0.10, pNormPot, $p={1.5}$']

In [10]:
res = [[res for key,res in results.items() if ' ExpPot' in key],
       [res for key,res in results.items() if 'pExpPot' in key],
       [res for key,res in results.items() if 'pNormPot' in key]]
pNres = [{key:res for key,res in results.items() if 'pNormPot, '+p in key} for p in ['$p={1.05}$', '$p={1.75}$']]
Expres = [{key:res for key,res in results.items() if ' ExpPot' in key}]
pNlabels = [[r.label.replace('pNormPot, ','') for r in rs.values()] for rs in pNres] 
plot_loglogs(pNres, directory=None, bounds=True)

Plot snapshots, create animations


In [9]:
plot_snapshots([val for val in results.values()], [10, 100, 225], show=True, directory=folder, figsize=(16,8),
               elev=30, azim=120)


Out[9]:
'v=0.05, $p={1.05}$'

When Greedy fails


In [9]:
folder = '/Users/balandat/Documents/Code/Continuous_No-Regret/results/2015-05-27_11-31/'
file = 'NIPS2_CNR_greedyfail_Affine.piggl'
with open(folder+file, 'rb') as f:
    results = pickle.load(f)
results = {r.label : r for r in results}
print(list(results.keys()))


['pNormPot, $p={1.75}$', 'pNormPot, $p={1.01}$', 'pExpPot, $p={1.5}, gamma={1}$', 'ExpPot', 'Greedy', 'ExpPPot, $p={1.5}, gamma={1}$']

In [10]:
res2 = {key:results[key] for key in results.keys() if key!='ExpPPot, $p={1.5}, gamma={1}$'}

In [12]:
plot_loglogs([res2], directory=folder, loc='upper center')

In [ ]: