def resample(self, data=[], niter=5): if len(data) == 0: self.low = -sample_pareto(-self.x_m_low, self.alpha_low) self.high = sample_pareto(self.x_m_high, self.alpha_high) else: for itr in range(niter): # resample high, fixing low self.x_m, self.alpha = self.x_m_high, self.alpha_high super(Uniform, self).resample(data) # tricky: flip data and resample 'high' again self.x_m, self.alpha = -self.x_m_low, self.alpha_low self.low, self.high = self.high, self.low super(Uniform, self).resample(self._flip_data(data)) self.low, self.high = self.x_m_low - self.high, self.low
def resample(self,data=[],niter=5): if len(data) == 0: self.low = -sample_pareto(-self.x_m_low,self.alpha_low) self.high = sample_pareto(self.x_m_high,self.alpha_high) else: for itr in xrange(niter): # resample high, fixing low self.x_m, self.alpha = self.x_m_high, self.alpha_high super(Uniform,self).resample(data) # tricky: flip data and resample 'high' again self.x_m, self.alpha = -self.x_m_low, self.alpha_low self.low, self.high = self.high, self.low super(Uniform,self).resample(self._flip_data(data)) self.low, self.high = self.x_m_low - self.high, self.low
def resample(self, data=[]): self.high = sample_pareto(*self._posterior_hypparams( *self._get_statistics(data))) return self
def resample(self,data=[]): self.high = sample_pareto( *self._posterior_hypparams(*self._get_statistics(data))) return self