예제 #1
0
파일: main.py 프로젝트: jahuth/ni
				for b in stats.filter(k).get('beta'): 
					plot(b)
				for b in stats.filter(k).get('boot_betas'): 
					for bb in b:
						plot(bb,'--')
		stats.save(path + identifier +E3+ '_' + str(cell) + "_" + str(m.name).replace("/","_") + '_stats.stat')
job "E3.4. Saving Data":
	require previous
	stats.load_glob(path + identifier +E3+ '_*_Model*_stats.stat')
	stats.save(path + identifier +E3+ '_all_models.stat')

job "Results 1. Plotting" for Ei in range(len(Es)):
	require "E1.2. Saving Data"
	require "E1b.2. Saving Data"
	require "E2.4. Saving Data"
	require "E3.4. Saving Data"
	E = Es[Ei]
	stats = StatCollector() 
	titles = results_titles
	invert = results_invert
	with View(job_path + '_results_' + E + 'plots.html') as view:
		stats.load(path + identifier + E + '_all_models.stat')
		for k in stats.keys():
			stats.stats[k]['BIC'] = stats.stats[k]['statistics']['bic'] # get bic from 'statistics' into the statcollector
		statsr = stats.rename_value_to_tree()
		for i in range(model_cells):
			for dim in ['EIC','AIC','BIC','EICE2','llf_test_model','llf_train_model']:
				with view.figure('Cells/tabs/'+str(i)+'/tree/'+dim):
					statsr.filter('Model 0').plotTree(dim)
		view.render(path+'results_'+E+identifier+'.html')
job "E3.4. Saving Data":
	require previous
	stats.load_glob(path + identifier +E3+ '_*_Model*_stats.stat')
	stats.save(path + identifier +E3+ '_all_models.stat')

job "Results 1. Plotting" for Ei in range(len(Es)):
	require "E1.2. Saving Data"
	require "E1b.2. Saving Data"
	require "E2.4. Saving Data"
	require "E3.4. Saving Data"
	E = Es[Ei]
	stats = StatCollector() 
	titles = results_titles
	invert = results_invert
	with View(job_path + '_results.html') as view:
		stats.load(path + identifier + E + '_all_models.stat')
		for k in stats.keys():
			stats.stats[k]['BIC'] = stats.stats[k]['statistics']['bic'] # get bic from 'statistics' into the statcollector
		all_l = []
		all_model_points = []
		for cell in model_cells:
			for dim in ['llf_test_model','EIC','AIC','llf_boot','llf_train','llf_train_model','llf_test','EICE_bias','EICE2','BIC']:
				print dim
				with view.figure("/tabs/"+E+"/Cells/tabs/Cell "+str(cell)+"/tabs/Trees From 2nd Level/tabs/"+dim,figsize=(7,10)):
					stats.filter('Model '+str(cell)).plotTree(dim)
					pylab.title(titles[dim])
				with view.figure("/tabs/"+E+"/Cells/tabs/Cell "+str(cell)+"/tabs/Trees From 2nd Level Inverse/tabs/"+dim,figsize=(7,10)):
					stats.filter('Model '+str(cell)).plotTree(dim,right_to_left=True)
					pylab.title(titles[dim])
			for dim in ['EICE','llf_boot','llf_train','llf_test','EICE_bias','EICE2','EICE_bias_uncorrected']:
				with view.figure("/tabs/"+E+"/Cumulative Mean/tabs/Cell "+str(cell)+"/tabs/Cumulative Mean/tabs/"+dim,figsize=(4,4)):