コード例 #1
0
ファイル: affiliationSims.py プロジェクト: dpmcsuss/stfpSim
 def plot_num_diff_vs_n(self, dim, matrix, scale):
     param = IterGrid({'dim':dim, 'matrix':matrix,'scale':scale})
     plot_bw = dpplot.plot_bw()
     
     for p in param:
         data,nnodes = zip(*[(np.mean(r['num_diff'])/r['nnodes'], r['nnodes'])
                            for r in self.results if r['matrix']==p['matrix'] 
                                                 and r['scale']==p['scale'] 
                                                 and r['dim']==p['dim']])
         line_label =  p['matrix']+(' (Scaled)' if p['scale'] else ' (Unscaled)')
         
         style = ('-' if p['matrix']=='Adjacency' else '--')
         color = ('b' if p['matrix']=='Adjacency' else 'r')
         marker = 's' if p['scale'] else 'd'
         markersize = 10
         plot.plot(nnodes, data, 
                   linestyle=style,marker=marker,
                   markersize=markersize, linewidth=2, color=color,label=line_label)
         
         #plot.plot(nnodes, data, label=line_label)
         
     plot.legend(loc='best')
     plot.ylabel("Percent Error")
     plot.xlabel(r'$n$ - Number of vertices')
     plot.show()
コード例 #2
0
ファイル: affiliationSims.py プロジェクト: dpmcsuss/stfpSim
 def plot_num_diff_vs_n_ari(self, dim, matrix, scale):
     param = IterGrid({'dim':dim, 'matrix':matrix,'scale':scale})
     plot_bw = dpplot.plot_bw()
     
     for p in param:
         data,nnodes = zip(*[(np.mean(r['rand_idx'])/r['nnodes'], r['nnodes'])
                            for r in self.results if r['matrix']==p['matrix'] 
                                                 and r['scale']==p['scale'] 
                                                 and r['dim']==p['dim']])
         line_label =  p['matrix']+(' (Scaled)' if p['scale'] else ' (Unscaled)') + ' dim.: '+repr(p['dim'])
         
         
         
         #plot.plot(nnodes, data, label=line_label)
         
     plot.legend(loc='best')
     plot.ylabel("Percent Error")
     plot.xlabel(r'$n$ - Number of vertices')
     plot.show()
コード例 #3
0
ファイル: affiliationSims.py プロジェクト: dpmcsuss/stfpSim
 def plot_num_diff_vs_d(self, nnodes):
     if nnodes not in self.nnodes:
         print "Woahh: we didn't do that number of nodes"
         return
     if not self.results:
         return "Get some results first ... run_monte_carlo()"
     
     plot_bw = dpplot.plot_bw()
     
     
     results = [r for r in self.results if r['nnodes']==nnodes]
     params = IterGrid({'matrix':self.matrix.keys(), 'scale':self.scale})
     for p in params:
         data,dim = zip(*[(np.mean(r['num_diff']), r['dim'])
                         for r in results if r['matrix']==p['matrix'] and r['scale']==p['scale'] ])
         
         line_label = p['matrix']+(' (Scaled)' if p['scale'] else ' (Unscaled)') 
         #legend.append(p['matrix']+"; Scale:"+repr(p['scale']))
         plot_bw.plot(dim, data, label=line_label)
         
     plot.legend(loc='best')
     plot.ylabel("Mean Number Errors")
     plot.xlabel("Embedding Dimension")
     plot.show()