示例#1
0
 def __getattr__(self,key):
     if key.startswith('_'): return self.__dict__[key]    
     d=getattr(self.data,key)
     
     if len(d)==0: return None,None,None
     try:
         low,high=bootstrapci(d,self.func)
     except Exception,e:
         return None,None,None    
示例#2
0
 def get_stat(self,stat,bootstrap_samples=1000,confidence=0.95):    
     code=(stat,bootstrap_samples,confidence)
     if code not in self.data:
         if stat in statistics:            
             raw=self.stats.get_raw(self.measure)
             skeys=statistics.keys()
             cis=bootstrapci(raw,[statistics[k] for k in skeys],n=bootstrap_samples,p=confidence)
             for i in range(len(skeys)):
                 self.data[(skeys[i],bootstrap_samples,confidence)]=cis[i]
         
         self.stats.summary[self.measure]=self.data
     
     return self.data.get(code,(None,(None,None)))
                y = 1.0

            data_x.append(x)
            data_y.append(y)
            print x, y

    #data_x = data_x[:30]
    #data_y = data_y[:30]

    data_x = np.array(data_x)
    data_y = np.array(data_y)


    mean = np.mean(data_y)
    sd = np.std(data_y)
    ci = bootstrapci.bootstrapci(data_y, np.mean)

    width = 0.3

    pylab.fill_between([index-width, index+width], mean-sd, mean+sd, color='#aaaaaa')
    pylab.scatter(np.random.uniform(index-width, index+width, data_y.shape), data_y, s=30, marker='x', color='k', alpha=0.3)
    error_means.append(mean)
    error_bars.append([mean-ci[0], ci[1]-mean])
    index += 1

error_bars = np.array(error_bars)

pylab.errorbar(np.arange(len(error_bars))+1, error_means, yerr=error_bars.T, color='k', linewidth=3, capthick=2, capsize=4)

pylab.xticks([1, 2, 3, 4], ['No adaptation', 'Intel i5-337U CPU\n(500 neurons)', 'Nvidia Tesla C2075 GPU\n(500 neurons)', 'SpiNNaker core\n(500 neurons)'])