Exemple #1
0
def testing_Sym():
    s1 = Sym()
    s1 = s1.syms(
        ['y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'n', 'n', 'n', 'n', 'n'])
    print(s1.symEnt())
    result = round(s1.symEnt(), 4)
    assert (result == 0.9403)
Exemple #2
0
def baseSym():
    s = Sym()
    s = s.syms(
        ['y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'n', 'n', 'n', 'n', 'n'])
    print(s.counts)
    print("Entropy: " + str(round(s.symEnt(), 4)))
    assert (round(s.symEnt(), 4) == 0.9403)
def testSample():
  """Testing Entropy Sampler"""
  s = Sym()
  syms = ['y','y','y','y','y','y','y','y','y',
	        'n','n','n','n','n']
  s.bulkAdd(syms)
  print("Items = ", syms)
  print("Entropy = ", '%.4f'%(s.symEnt()))
  assert math.isclose(s.symEnt(), 0.9403, rel_tol = 0.01)
Exemple #4
0
def test_sym():
    s = Sym(['y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y',
             'n', 'n', 'n', 'n', 'n'])
    print(s.symEnt())
    assert round(s.symEnt(), 4) == 0.9403
Exemple #5
0
def testSym():
    s = Sym(
        ['y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'n', 'n', 'n', 'n', 'n'])
    assert abs(s.symEnt() - 0.9403) / 0.9403 < 0.01
    print(s.symEnt())
Exemple #6
0
def testSym():
    sy = Sym(
        ['y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'n', 'n', 'n', 'n', 'n'])
    assert round(sy.symEnt(), 4) == 0.9403