예제 #1
0
 def test_calc_gini(self):
     #test that two Gini formulae give same result
     gini1 = calc_gini(self.wealths)
     gini2 = calc_gini2(self.wealths)
     gini3 = calc_gini3(self.wealths)
     gini4 = calc_gini4(self.wealths)
     #print "gini1:%f, gini2:%f"%(gini1, gini2)
     self.assert_(fmath.feq(gini1, gini2))
     self.assert_(fmath.feq(gini1, gini3))
     print gini1, gini4
     self.assert_(fmath.feq(gini1, gini4))
예제 #2
0
 def test_calc_gini(self):
     # test that two Gini formulae give same result
     gini1 = calc_gini(self.wealths)
     gini2 = calc_gini2(self.wealths)
     gini3 = calc_gini3(self.wealths)
     gini4 = calc_gini4(self.wealths)
     # print "gini1:%f, gini2:%f"%(gini1, gini2)
     self.assert_(fmath.feq(gini1, gini2))
     self.assert_(fmath.feq(gini1, gini3))
     print gini1, gini4
     self.assert_(fmath.feq(gini1, gini4))
예제 #3
0
	def testGini(self):  #TODO: move this
		gini1 = calc_gini(self.wealths)
		gini2 = calc_gini2(self.wealths)
		print "gini1:%f, gini2:%f"%(gini1, gini2)
		self.assert_( abs(gini1-gini2)<1e-8 )