def test_truth_is_minimum_of_objfunc(self, nTrial=2):
    vopt = HBO.beta2v(self.truebeta)
    objfunc = lambda v: HBO.objectiveFunc(v, self.alpha, self.gamma, self.G, self.sumLogPi)
    success = 0
    fopt = objfunc(vopt)
    print vopt, fopt, '**'

    for trial in range(nTrial):
      v = vopt + 0.01 * self.PRNG.rand(self.K)
      v = np.minimum(v, 1.0 - 1e-8)
      fv = objfunc(v)
      if fopt < fv:
        success += 1
      else:
        print v, fv
    assert success > 0.98 * nTrial
dataset/ETHPy150Open daeilkim/refinery/refinery/bnpy/bnpy-dev/tests/allocmodel/admix/TestHDPBetaOptimizer.py/TestHBOK2.test_truth_is_minimum_of_objfunc/original