Esempio n. 1
0
 def test_histogram(self):
     "Testing histogram"
     data = [ self.L, self.A ]
     results1 = ([2, 2, 2, 2, 2, 2, 2, 2, 2, 2], -0.045000050000000069, 2.0900001000000001, 0)
     results2 = (num_array([ 2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.]), -0.045000050000000069, 2.0900001000000001, 0)
     
     i = 0
     for d in data:
         self.assertEqual( stats.histogram( d )[i], results1[i] ) 
         i += 1
Esempio n. 2
0
 def test_histogram(self):
     "Testing histogram"
     data = [ self.L, self.A ]
     results1 = ([2, 2, 2, 2, 2, 2, 2, 2, 2, 2], -0.045000050000000069, 2.0900001000000001, 0)
     results2 = (num_array([ 2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.]), -0.045000050000000069, 2.0900001000000001, 0)
     
     i = 0
     for d in data:
         self.assertEqual( stats.histogram( d )[i], results1[i] ) 
         i += 1
Esempio n. 3
0
 def _format_ratings(self, output):
     ratings = []
     for result in self.data:
         try:
             ratings.append( float(result[0].toPython()) )
         except ValueError:
             pass
     output['results'] = {}
     if ratings:
         output['results']['median'] = stats.medianscore(ratings)
         output['results']['mode'] = stats.mode(ratings)
         output['results']['mean'] = stats.mean(ratings)
         output['results']['histogram'] = stats.histogram(ratings,6)
         output['results']['cumfreq'] = stats.cumfreq(ratings,6)
     output['results']['count'] = len(ratings)
     return output
Esempio n. 4
0
print(stats.describe(lf))
print(stats.describe(a))
print(stats.describe(af))

print('\nFREQUENCY')
print('freqtable:')
print('itemfreq:')
print(stats.itemfreq(l))
print(stats.itemfreq(a))
print('scoreatpercentile:', stats.scoreatpercentile(l, 40),
      stats.scoreatpercentile(lf, 40), stats.scoreatpercentile(a, 40),
      stats.scoreatpercentile(af, 40))
print('percentileofscore:', stats.percentileofscore(l, 12),
      stats.percentileofscore(lf, 12), stats.percentileofscore(a, 12),
      stats.percentileofscore(af, 12))
print('histogram:', stats.histogram(l), stats.histogram(a))
print('cumfreq:')
print(stats.cumfreq(l))
print(stats.cumfreq(lf))
print(stats.cumfreq(a))
print(stats.cumfreq(af))
print('relfreq:')
print(stats.relfreq(l))
print(stats.relfreq(lf))
print(stats.relfreq(a))
print(stats.relfreq(af))

print('\nVARIATION')
print('obrientransform:')

l = list(range(1, 21))
print 'tstdev:',stats.tstdev(a,(5,17)),stats.tstdev(af,(5,17))
print 'tsem:',stats.tsem(a,(5,17)),stats.tsem(af,(5,17))
print 'describe:'
print stats.describe(l)
print stats.describe(lf)
print stats.describe(a)
print stats.describe(af)

print '\nFREQUENCY'
print 'freqtable:'
print 'itemfreq:'
print stats.itemfreq(l)
print stats.itemfreq(a)
print 'scoreatpercentile:',stats.scoreatpercentile(l,40),stats.scoreatpercentile(lf,40),stats.scoreatpercentile(a,40),stats.scoreatpercentile(af,40)
print 'percentileofscore:',stats.percentileofscore(l,12),stats.percentileofscore(lf,12),stats.percentileofscore(a,12),stats.percentileofscore(af,12)
print 'histogram:',stats.histogram(l),stats.histogram(a)
print 'cumfreq:'
print stats.cumfreq(l)
print stats.cumfreq(lf)
print stats.cumfreq(a)
print stats.cumfreq(af)
print 'relfreq:'
print stats.relfreq(l)
print stats.relfreq(lf)
print stats.relfreq(a)
print stats.relfreq(af)

print '\nVARIATION'
print 'obrientransform:'

l = range(1,21)
Esempio n. 6
0
                        b.place_the_number(i, 6)
                        stake -= 6
                if debug:
                    print "placing across, stake = %s" % stake 
    
            g.roll_dice(verbose=debug)
            if debug:
                print b.show_bets()
            win = b.check_winnings(verbose=debug)
            if win:
                stake += win
            if debug:
                print "Roll %s stake = %s" % (i, stake)

        print "Ending Stake = %s, ATM withdraws = %s" % (stake, atm)
        stakes.append(stake)
        atms.append(atm)
        profits.append(stake - atm)
       
#    print "Stake (min, mean, max) = (%s, %s, %s)" % (min(stakes), stats.mean(stakes), max(stakes))
#    print "ATM (min, mean, max) = (%s, %s, %s)" % (min(atms), stats.mean(atms), max(atms))
    print "Profits (min, mean, max) = (%s, %s, %s)" % (min(profits), stats.mean(profits), max(profits))
    hist = stats.histogram(profits)
    stake_bins = hist[0]
    stake_start = hist[1]
    stake_width = hist[2]
    print "Profits histogram:"
    for b in stake_bins:
        print "%s - %s: %s" % (stake_start, stake_start + stake_width, b)
        stake_start += stake_width
 def evaluate(self, *args, **params):
     return _stats.histogram(*args, **params)
Esempio n. 8
0
print stats.describe(lf)
print stats.describe(a)
print stats.describe(af)

print '\nFREQUENCY'
print 'freqtable:'
print 'itemfreq:'
print stats.itemfreq(l)
print stats.itemfreq(a)
print 'scoreatpercentile:', stats.scoreatpercentile(
    l, 40), stats.scoreatpercentile(lf, 40), stats.scoreatpercentile(
        a, 40), stats.scoreatpercentile(af, 40)
print 'percentileofscore:', stats.percentileofscore(
    l, 12), stats.percentileofscore(lf, 12), stats.percentileofscore(
        a, 12), stats.percentileofscore(af, 12)
print 'histogram:', stats.histogram(l), stats.histogram(a)
print 'cumfreq:'
print stats.cumfreq(l)
print stats.cumfreq(lf)
print stats.cumfreq(a)
print stats.cumfreq(af)
print 'relfreq:'
print stats.relfreq(l)
print stats.relfreq(lf)
print stats.relfreq(a)
print stats.relfreq(af)

print '\nVARIATION'
print 'obrientransform:'

l = range(1, 21)
Esempio n. 9
0
                        stake -= 6
#           print "Stake = %s" % stake
            g.roll(verbose=False)
            win = g.winnings()
#            print "rolled %s won $%s" % (g.last_roll, win)
            if win:
                stake += win
        print "Ending Stake = %s, ATM withdraws = %s" % (stake, atm)
        stakes.append(stake)
        atms.append(atm)
        profits.append(stake - atm)

    print "Stake (min, mean, max) = (%s, %s, %s)" % (min(stakes), stats.mean(stakes), max(stakes))
    print "ATM (min, mean, max) = (%s, %s, %s)" % (min(atms), stats.mean(atms), max(atms))
    print "Profits (min, mean, max) = (%s, %s, %s)" % (min(profits), stats.mean(profits), max(profits))
    hist = stats.histogram(profits)
    stake_bins = hist[0]
    stake_start = hist[1]
    stake_width = hist[2]
    print "Profits histogram:"
    for b in stake_bins:
        print "%s - %s: %s" % (stake_start, stake_start + stake_width, b)
        stake_start += stake_width
    a_hist = stats.histogram(atms)
    a_bins = a_hist[0]
    a_start = a_hist[1]
    a_width = a_hist[2]
#    print "ATM histogram:"
    for a in a_bins:
#        print "%s - %s: %s" % (a_start, a_start + a_width, a)
        a_start += a_width