In [1]:
# July 31 2017
# This file is for experiments with student2 4 skills and training trajectory length 7
# to check different architectures and whether they can learn good models
%load_ext autoreload
%autoreload 2
%matplotlib inline
import numpy as np
import scipy as sp
import six
from matplotlib.pyplot import *
In [10]:
'''
Default Double LSTM
Trying to find a training epoch to stop training.
'''
data11 = np.load('experiments/test2_model_small-dropout10-shuffle0-data-test2-n100000-l7-random.pickle/stats-runA.npz')
vloss = data11['vloss']
#scores = data21['scores'][:,0]
#initialq = data51['qvals'][:,0]
#opts = data61['opts']
#qfuncs = data61['qs'][:,0,:,:]
six.print_(vloss.shape)
figure()
x_avg = np.mean(vloss,axis=0)
x_serr = np.std(vloss,axis=0) / vloss.shape[0] * 1.98
plot(x_avg, color='#0000ff')
plot(x_avg + x_serr, color='#ddddff')
plot(x_avg - x_serr, color='#ddddff')
x_end = np.mean(x_avg[-2:])
x_thres = 0.00126
six.print_('last {} threshold {}'.format(x_end, x_thres))
plot([0,20],[x_end,x_end],color='#ff0000')
plot([0,20],[x_thres,x_thres],color='#ff0000')
xlim(10, 15)
ylim(0.0012,0.0014)
# looks like epoch 11 is good for 0.00001
# but might as well just make it 12 to be consistent with the others
Out[10]:
In [14]:
'''
Single LSTM
Trying to find a training epoch to stop training.
'''
data11 = np.load('experiments/test2_modelsimple_small-dropout10-shuffle0-data-test2-n100000-l7-random.pickle/stats-runA.npz')
vloss = data11['vloss']
#scores = data21['scores'][:,0]
#initialq = data51['qvals'][:,0]
#opts = data61['opts']
#qfuncs = data61['qs'][:,0,:,:]
six.print_(vloss.shape)
figure()
x_avg = np.mean(vloss,axis=0)
x_serr = np.std(vloss,axis=0) / vloss.shape[0] * 1.98
plot(x_avg, color='#0000ff')
plot(x_avg + x_serr, color='#ddddff')
plot(x_avg - x_serr, color='#ddddff')
x_end = np.mean(x_avg[-2:])
x_thres = 0.00001
six.print_('last {} threshold {}'.format(x_end, x_thres))
plot([0,20],[x_end,x_end],color='#ff0000')
plot([0,20],[x_thres,x_thres],color='#ff0000')
#xlim(10, 15)
#ylim(0.00,0.00002)
# looks like epoch 12 is good for 0.00001
Out[14]:
In [25]:
'''
Double GRU
Trying to find a training epoch to stop training.
'''
data11 = np.load('experiments/test2_modelgru_small-dropout10-shuffle0-data-test2-n100000-l7-random.pickle/stats-runA.npz')
vloss = data11['vloss']
#scores = data21['scores'][:,0]
#initialq = data51['qvals'][:,0]
#opts = data61['opts']
#qfuncs = data61['qs'][:,0,:,:]
six.print_(vloss.shape)
figure()
x_avg = np.mean(vloss,axis=0)
x_serr = np.std(vloss,axis=0) / vloss.shape[0] * 1.98
plot(x_avg, color='#0000ff')
plot(x_avg + x_serr, color='#ddddff')
plot(x_avg - x_serr, color='#ddddff')
x_end = np.mean(x_avg[-2:])
x_thres = 0.00009
six.print_('last {} threshold {}'.format(x_end, x_thres))
plot([0,20],[x_end,x_end],color='#ff0000')
plot([0,20],[x_thres,x_thres],color='#ff0000')
xlim(10, 15)
ylim(0.00,0.0001)
# looks like epoch 12 is good for 0.00001
Out[25]:
In [7]:
'''
Analyzing results of student2 with 4 skills, with training length 7 and testing length 6.
Default Double LSTM
Looking at correlation between training AUC and actual performance
'''
data11 = np.load('experiments/test2_model_small-dropout10-shuffle0-data-test2-n100000-l7-random.pickle/stats-runB.npz')
data21 = np.load('experiments/test2_model_small-dropout10-shuffle0-data-test2-n100000-l7-random.pickle/mcts-rtype2-rollouts3000-trajectories100-real1-runB.npz')
vloss = data11['vloss']
scores = data21['scores'][:,0]
#initialq = data51['qvals'][:,0]
#opts = data61['opts']
#qfuncs = data61['qs'][:,0,:,:]
six.print_('vloss shape {}'.format(vloss.shape))
#six.print_(vloss)
six.print_('scores shape {}'.format(scores.shape))
six.print_(scores)
xs = np.sum(vloss,axis=1)
ys = scores
title('Training Loss AUC versus Actual Performance')
xlabel('Training Loss AUC')
ylabel('Posttest Score')
plot(xs,ys,'.')
Out[7]:
In [8]:
'''
Analyzing results of student2 with 4 skills, with training length 7 and testing length 6.
Single LSTM
Looking at correlation between training AUC and actual performance
'''
data11 = np.load('experiments/test2_modelsimple_small-dropout10-shuffle0-data-test2-n100000-l7-random.pickle/stats-runB.npz')
data21 = np.load('experiments/test2_modelsimple_small-dropout10-shuffle0-data-test2-n100000-l7-random.pickle/mcts-rtype2-rollouts3000-trajectories100-real1-runB.npz')
vloss = data11['vloss']
scores = data21['scores'][:,0]
#initialq = data51['qvals'][:,0]
#opts = data61['opts']
#qfuncs = data61['qs'][:,0,:,:]
six.print_('vloss shape {}'.format(vloss.shape))
#six.print_(vloss)
six.print_('scores shape {}'.format(scores.shape))
six.print_(scores)
xs = np.sum(vloss,axis=1)
ys = scores
title('Training Loss AUC versus Actual Performance')
xlabel('Training Loss AUC')
ylabel('Posttest Score')
plot(xs,ys,'.')
Out[8]:
In [9]:
'''
Analyzing results of student2 with 4 skills, with training length 7 and testing length 6.
Double GRU
Looking at correlation between training AUC and actual performance
'''
data11 = np.load('experiments/test2_modelgru_small-dropout10-shuffle0-data-test2-n100000-l7-random.pickle/stats-runB.npz')
data21 = np.load('experiments/test2_modelgru_small-dropout10-shuffle0-data-test2-n100000-l7-random.pickle/mcts-rtype2-rollouts3000-trajectories100-real1-runB.npz')
vloss = data11['vloss']
scores = data21['scores'][:,0]
#initialq = data51['qvals'][:,0]
#opts = data61['opts']
#qfuncs = data61['qs'][:,0,:,:]
six.print_('vloss shape {}'.format(vloss.shape))
#six.print_(vloss)
six.print_('scores shape {}'.format(scores.shape))
six.print_(scores)
xs = np.sum(vloss,axis=1)
ys = scores
title('Training Loss AUC versus Actual Performance')
xlabel('Training Loss AUC')
ylabel('Posttest Score')
plot(xs,ys,'.')
Out[9]:
In [9]:
'''
Default Double LSTM
Trying to find a training epoch to stop training.
'''
data11 = np.load('experiments/test2_model_small-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runA.npz')
vloss = data11['vloss']
#scores = data21['scores'][:,0]
#initialq = data51['qvals'][:,0]
#opts = data61['opts']
#qfuncs = data61['qs'][:,0,:,:]
six.print_(vloss.shape)
figure()
x_avg = np.mean(vloss,axis=0)
x_serr = np.std(vloss,axis=0) / vloss.shape[0] * 1.98
plot(x_avg, color='#0000ff')
plot(x_avg + x_serr, color='#ddddff')
plot(x_avg - x_serr, color='#ddddff')
x_end = np.mean(x_avg[-2:])
x_thres = 0.00146
six.print_('last {} threshold {}'.format(x_end, x_thres))
plot([0,20],[x_end,x_end],color='#ff0000')
plot([0,20],[x_thres,x_thres],color='#ff0000')
xlim(5, 10)
ylim(0.0014,0.0015)
# looks like epoch 9 is good for 0.00001
Out[9]:
In [13]:
'''
Single LSTM
Trying to find a training epoch to stop training.
'''
data11 = np.load('experiments/test2_modelsimple_small-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runA.npz')
vloss = data11['vloss']
#scores = data21['scores'][:,0]
#initialq = data51['qvals'][:,0]
#opts = data61['opts']
#qfuncs = data61['qs'][:,0,:,:]
six.print_(vloss.shape)
figure()
x_avg = np.mean(vloss,axis=0)
x_serr = np.std(vloss,axis=0) / vloss.shape[0] * 1.98
plot(x_avg, color='#0000ff')
plot(x_avg + x_serr, color='#ddddff')
plot(x_avg - x_serr, color='#ddddff')
x_end = np.mean(x_avg[-2:])
x_thres = 0.00001
six.print_('last {} threshold {}'.format(x_end, x_thres))
plot([0,20],[x_end,x_end],color='#ff0000')
plot([0,20],[x_thres,x_thres],color='#ff0000')
xlim(5, 10)
ylim(0.00,0.00002)
# looks like epoch 8 is good for 0.00001
Out[13]:
In [5]:
'''
Double GRU.
Trying to find a training epoch to stop training.
'''
data11 = np.load('experiments/test2_modelgru_small-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runA.npz')
vloss = data11['vloss']
#scores = data21['scores'][:,0]
#initialq = data51['qvals'][:,0]
#opts = data61['opts']
#qfuncs = data61['qs'][:,0,:,:]
six.print_(vloss.shape)
figure()
x_avg = np.mean(vloss,axis=0)
x_serr = np.std(vloss,axis=0) / vloss.shape[0] * 1.98
plot(x_avg, color='#0000ff')
plot(x_avg + x_serr, color='#ddddff')
plot(x_avg - x_serr, color='#ddddff')
x_end = np.mean(x_avg[-2:])
x_thres = 0.00001
six.print_('last {} threshold {}'.format(x_end, x_thres))
plot([0,20],[x_end,x_end],color='#ff0000')
plot([0,20],[x_thres,x_thres],color='#ff0000')
#xlim(5, 10)
#ylim(0.00,0.00002)
# looks like epoch 6 is good for 0.00001
Out[5]:
In [2]:
'''
Analyzing results of student2 with 4 skills, with training length 7 and testing length 6.
Behavior policy is egreedy0.3
Default Double LSTM
Looking at correlation between training AUC and actual performance
'''
data11 = np.load('experiments/test2_model_small-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runB.npz')
data21 = np.load('experiments/test2_model_small-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/mcts-rtype2-rollouts3000-trajectories100-real1-runB.npz')
vloss = data11['vloss']
scores = data21['scores'][:,0]
six.print_('vloss shape {}'.format(vloss.shape))
#six.print_(vloss)
six.print_('scores shape {}'.format(scores.shape))
six.print_(scores)
xs = np.sum(vloss,axis=1)
ys = scores
title('Training Loss AUC versus Actual Performance')
xlabel('Training Loss AUC')
ylabel('Posttest Score')
plot(xs,ys,'.')
# 4 good models, 2 more kind of good models
Out[2]:
In [3]:
'''
Analyzing results of student2 with 4 skills, with training length 7 and testing length 6.
Behavior policy is egreedy0.3
Single LSTM
Looking at correlation between training AUC and actual performance
'''
data11 = np.load('experiments/test2_modelsimple_small-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runB.npz')
data21 = np.load('experiments/test2_modelsimple_small-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/mcts-rtype2-rollouts3000-trajectories100-real1-runB.npz')
vloss = data11['vloss']
scores = data21['scores'][:,0]
six.print_('vloss shape {}'.format(vloss.shape))
#six.print_(vloss)
six.print_('scores shape {}'.format(scores.shape))
six.print_(scores)
xs = np.sum(vloss,axis=1)
ys = scores
title('Training Loss AUC versus Actual Performance')
xlabel('Training Loss AUC')
ylabel('Posttest Score')
plot(xs,ys,'.')
# 6 good models, 2 more kinda good models
Out[3]:
In [4]:
'''
Analyzing results of student2 with 4 skills, with training length 7 and testing length 6.
Behavior policy is egreedy0.3
Double GRU
Looking at correlation between training AUC and actual performance
'''
data11 = np.load('experiments/test2_modelgru_small-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runB.npz')
data21 = np.load('experiments/test2_modelgru_small-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/mcts-rtype2-rollouts3000-trajectories100-real1-runB.npz')
vloss = data11['vloss']
scores = data21['scores'][:,0]
six.print_('vloss shape {}'.format(vloss.shape))
#six.print_(vloss)
six.print_('scores shape {}'.format(scores.shape))
six.print_(scores)
xs = np.sum(vloss,axis=1)
ys = scores
title('Training Loss AUC versus Actual Performance')
xlabel('Training Loss AUC')
ylabel('Posttest Score')
plot(xs,ys,'.')
# 4 good models
Out[4]:
In [7]:
'''
Default Double LSTM
Trying to find a training epoch to stop training.
'''
data11 = np.load('experiments/test2_model_mid-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runA.npz')
vloss = data11['vloss']
six.print_(vloss.shape)
figure()
x_avg = np.mean(vloss,axis=0)
x_serr = np.std(vloss,axis=0) / vloss.shape[0] * 1.98
plot(x_avg, color='#0000ff')
plot(x_avg + x_serr, color='#ddddff')
plot(x_avg - x_serr, color='#ddddff')
x_end = np.mean(x_avg[-2:])
x_thres = 0.00146
six.print_('last {} threshold {}'.format(x_end, x_thres))
plot([0,20],[x_end,x_end],color='#ff0000')
plot([0,20],[x_thres,x_thres],color='#ff0000')
xlim(5, 10)
ylim(0.0014,0.0015)
# looks like epoch 6 is good for 0.00001
Out[7]:
In [10]:
'''
Single LSTM
Trying to find a training epoch to stop training.
'''
data11 = np.load('experiments/test2_modelsimple_mid-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runA.npz')
vloss = data11['vloss']
six.print_(vloss.shape)
figure()
x_avg = np.mean(vloss,axis=0)
x_serr = np.std(vloss,axis=0) / vloss.shape[0] * 1.98
plot(x_avg, color='#0000ff')
plot(x_avg + x_serr, color='#ddddff')
plot(x_avg - x_serr, color='#ddddff')
x_end = np.mean(x_avg[-2:])
x_thres = 0.00001
six.print_('last {} threshold {}'.format(x_end, x_thres))
plot([0,20],[x_end,x_end],color='#ff0000')
plot([0,20],[x_thres,x_thres],color='#ff0000')
xlim(0, 6)
ylim(0.00,0.0001)
# looks like epoch 5 is good for 0.00001
Out[10]:
In [11]:
'''
Double GRU
Trying to find a training epoch to stop training.
'''
data11 = np.load('experiments/test2_modelgru_mid-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runA.npz')
vloss = data11['vloss']
six.print_(vloss.shape)
figure()
x_avg = np.mean(vloss,axis=0)
x_serr = np.std(vloss,axis=0) / vloss.shape[0] * 1.98
plot(x_avg, color='#0000ff')
plot(x_avg + x_serr, color='#ddddff')
plot(x_avg - x_serr, color='#ddddff')
x_end = np.mean(x_avg[-2:])
x_thres = 0.00001
six.print_('last {} threshold {}'.format(x_end, x_thres))
plot([0,20],[x_end,x_end],color='#ff0000')
plot([0,20],[x_thres,x_thres],color='#ff0000')
xlim(0, 6)
ylim(0.00,0.0001)
# looks like epoch 4 is good for 0.00001
Out[11]:
In [2]:
'''
Analyzing results of student2 with 4 skills, with training length 7 and testing length 6.
Behavior policy is egreedy0.3
Default Double LSTM
Looking at correlation between training AUC and actual performance
'''
data11 = np.load('experiments/test2_model_mid-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runB.npz')
data21 = np.load('experiments/test2_model_mid-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/mcts-rtype2-rollouts3000-trajectories100-real1-runB.npz')
vloss = data11['vloss']
scores = data21['scores'][:,0]
six.print_('vloss shape {}'.format(vloss.shape))
#six.print_(vloss)
six.print_('scores shape {}'.format(scores.shape))
six.print_(scores)
xs = np.sum(vloss,axis=1)
ys = scores
title('Training Loss AUC versus Actual Performance')
xlabel('Training Loss AUC')
ylabel('Posttest Score')
plot(xs,ys,'.')
# 5 models >90%
Out[2]:
In [3]:
'''
Analyzing results of student2 with 4 skills, with training length 7 and testing length 6.
Behavior policy is egreedy0.3
Single LSTM
Looking at correlation between training AUC and actual performance
'''
data11 = np.load('experiments/test2_modelsimple_mid-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runB.npz')
data21 = np.load('experiments/test2_modelsimple_mid-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/mcts-rtype2-rollouts3000-trajectories100-real1-runB.npz')
vloss = data11['vloss']
scores = data21['scores'][:,0]
six.print_('vloss shape {}'.format(vloss.shape))
#six.print_(vloss)
six.print_('scores shape {}'.format(scores.shape))
six.print_(scores)
xs = np.sum(vloss,axis=1)
ys = scores
title('Training Loss AUC versus Actual Performance')
xlabel('Training Loss AUC')
ylabel('Posttest Score')
plot(xs,ys,'.')
# 6 models >90%
Out[3]:
In [4]:
'''
Analyzing results of student2 with 4 skills, with training length 7 and testing length 6.
Behavior policy is egreedy0.3
Double GRU
Looking at correlation between training AUC and actual performance
'''
data11 = np.load('experiments/test2_modelgru_mid-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/stats-runB.npz')
data21 = np.load('experiments/test2_modelgru_mid-dropout10-shuffle0-data-test2-n100000-l7-egreedy0.30.pickle/mcts-rtype2-rollouts3000-trajectories100-real1-runB.npz')
vloss = data11['vloss']
scores = data21['scores'][:,0]
six.print_('vloss shape {}'.format(vloss.shape))
#six.print_(vloss)
six.print_('scores shape {}'.format(scores.shape))
six.print_(scores)
xs = np.sum(vloss,axis=1)
ys = scores
title('Training Loss AUC versus Actual Performance')
xlabel('Training Loss AUC')
ylabel('Posttest Score')
plot(xs,ys,'.')
# 3 models >90%
Out[4]:
In [ ]: