Example #1
0
    def generate_and_score_samples(self):
        sample_list = []
        target_list = flex.double()
        for ii in range(self.sample_size):
            x = random_transform.t_variate(a=max(2, self.n - 1), N=self.n)
            x = x * self.sigma + self.mean
            t = self.compute_target(x)
            sample_list.append(x)
            target_list.append(t)

        order = flex.sort_permutation(flex.double(target_list))
        return sample_list, t, order
Example #2
0
  def generate_and_score_samples(self):
    sample_list = []
    target_list = flex.double()
    for ii in range(self.sample_size):
      x = random_transform.t_variate(a=max(2,self.n-1),N=self.n)
      x = x*self.sigma + self.mean
      t = self.compute_target(x )
      sample_list.append( x )
      target_list.append( t )

    order = flex.sort_permutation( flex.double(target_list) )
    return sample_list, t, order
Example #3
0
def exercise_t_variate():
    data = rt.t_variate(a=6, mu=0, sigma=1, N=1000000)
    mu1 = flex.mean(data)
    mu2 = flex.mean(data * data)
    assert approx_equal(mu1, 0, eps=0.02)
    assert approx_equal(mu2, 1.5, eps=0.04)
def exercise_t_variate():
  data = rt.t_variate(a=6, mu=0,sigma=1,N=1000000)
  mu1 = flex.mean(data)
  mu2 = flex.mean(data*data)
  assert approx_equal(mu1,0,eps=0.02)
  assert approx_equal(mu2,1.5,eps=0.04)