-->

Wednesday, October 24, 2012

pylab pills



# simple heatmap

loadtxt('simple')
z=reshape(s[:,2],(6,3))
imshow(z,extent=(1,size(z,1),1,size(z,0)))
colorbar()









mypc@ ~ [10:31 AM]:> m simple 
 1 2 61.6526
 1 3 61.6526
 1 4 61.6526
 2 2 62.6341
 2 3 62.6113
 2 4 62.6113
 3 2 62.0920
 3 3 62.0977
 3 4 62.0920
 4 2 55.8777
 4 3 58.4170
 4 4 55.8777
 5 2 49.2125
 5 3 51.3753
 5 4 53.0358
 6 2 53.4924
 6 3 54.9760
 6 4 53.4924


# Simple graph with minimal configuration




prK_ml=loadtxt('pr_multilabel')                                                                                                                       
prK_mc=loadtxt('pr_multiclass')                                                                                                                       
fig = figure(figsize=(4,4))                                                                                                                           
title('Top-K (%)')                                                                                                                                    
xlb=xlabel('K',fontsize=20)                                                                                                                           
grid(True)                                                                                                                                            
ax = fig.add_subplot(111) # 1x1 grid ( in position 1)                                                                                                 
setp(ax.get_xticklabels(), fontsize=16)                                                                                                               
setp(ax.get_yticklabels(), fontsize=16)                                                                                                               
plot(1-prK_ml,linewidth=10.0,label='1-vs-rest')                                                                                                     
plot(prK_mc,linewidth=10.0,label='multiclass')                                                                                                        
legend(loc=4)                                                                                                                                         
savefig('samplefigure', bbox_extra_artists=(xlb,), bbox_inches='tight')        







# histogram with full optionsals


fig = figure(figsize=(9,4))                                                                                                          
ax = fig.add_subplot(111) # 1x1 grid ( in position 1)                                                                                
title('Pdfs for scores (after sigmoid) of 10 random attributes')                                                                     
xlb=xlabel('score',fontsize=20)                                                                                                      
setp(ax.get_xticklabels(), fontsize=16)                                                                                              
setp(ax.get_yticklabels(), fontsize=16)                                                                                              
for i in andint(1,80,3):hist(mat[:,i],frange(-7.0,5.0,0.05),  normed=1, histtype='step', rwidth=4.0);                               
savefig('pdfScores', bbox_extra_artists=(xlb,))                                                                                      
                                                             

No comments:

Post a Comment