Analyze Hebbian Learning with different choices of hyperparameters
In [1]:
%load_ext autoreload
%autoreload 2
In [2]:
import sys
sys.path.append("../../")
In [3]:
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
import tabulate
import pprint
import click
import numpy as np
import pandas as pd
from ray.tune.commands import *
from dynamic_sparse.common.browser import *
In [4]:
exps = ['neurips_debug_test2', ]
paths = [os.path.expanduser("~/nta/results/{}".format(e)) for e in exps]
df = load_many(paths)
In [5]:
df.head(5)
Out[5]:
In [6]:
df.columns
Out[6]:
In [7]:
df.shape
Out[7]:
In [8]:
df.iloc[1]
Out[8]:
In [9]:
df.groupby('model')['model'].count()
Out[9]:
Experiment Details
In [10]:
# Did any trials failed?
df[df["epochs"]<30]["epochs"].count()
Out[10]:
In [11]:
# Removing failed or incomplete trials
df_origin = df.copy()
df = df_origin[df_origin["epochs"]>=30]
df.shape
Out[11]:
In [12]:
# which ones failed?
# failed, or still ongoing?
df_origin['failed'] = df_origin["epochs"]<30
df_origin[df_origin['failed']]['epochs']
Out[12]:
In [13]:
# helper functions
def mean_and_std(s):
return "{:.3f} ± {:.3f}".format(s.mean(), s.std())
def round_mean(s):
return "{:.0f}".format(round(s.mean()))
stats = ['min', 'max', 'mean', 'std']
def agg(columns, filter=None, round=3):
if filter is None:
return (df.groupby(columns)
.agg({'val_acc_max_epoch': round_mean,
'val_acc_max': stats,
'model': ['count']})).round(round)
else:
return (df[filter].groupby(columns)
.agg({'val_acc_max_epoch': round_mean,
'val_acc_max': stats,
'model': ['count']})).round(round)
In [14]:
agg(['hebbian_prune_perc'])
Out[14]:
In [19]:
relu_only = (df['use_kwinners'] == False)
agg(['hebbian_prune_perc'], relu_only)
Out[19]:
In [20]:
kwinners_only = (df['use_kwinners'] == True)
agg(['hebbian_prune_perc'], kwinners_only)
Out[20]:
In [15]:
with_pruning = (df['hebbian_prune_perc'] > 0)
agg(['hebbian_grow'], with_pruning)
Out[15]:
In [16]:
with_pruning = (df['hebbian_prune_perc'] > 0)
agg(['hebbian_prune_perc', 'hebbian_grow'])
Out[16]:
In [ ]:
In [17]:
agg(['use_kwinners'])
Out[17]:
In [18]:
agg(['hebbian_prune_perc', 'use_kwinners'])
Out[18]:
In [ ]: