예제 #1
0
l = list(range(1, 21))
lf = list(range(1, 21))
lf[2] = 3.0
a = N.array(l)
af = N.array(lf)
ll = [l] * 5
aa = N.array(ll)

print('\nCENTRAL TENDENCY')
print('geometricmean:', stats.geometricmean(l), stats.geometricmean(lf),
      stats.geometricmean(a), stats.geometricmean(af))
print('harmonicmean:', stats.harmonicmean(l), stats.harmonicmean(lf),
      stats.harmonicmean(a), stats.harmonicmean(af))
print('mean:', stats.mean(l), stats.mean(lf), stats.mean(a), stats.mean(af))
print('median:', stats.median(l), stats.median(lf), stats.median(a),
      stats.median(af))
print('medianscore:', stats.medianscore(l), stats.medianscore(lf),
      stats.medianscore(a), stats.medianscore(af))
print('mode:', stats.mode(l), stats.mode(a))

print('\nMOMENTS')
print('moment:', stats.moment(l), stats.moment(lf), stats.moment(a),
      stats.moment(af))
print('variation:', stats.variation(l), stats.variation(a),
      stats.variation(lf), stats.variation(af))
print('skew:', stats.skew(l), stats.skew(lf), stats.skew(a), stats.skew(af))
print('kurtosis:', stats.kurtosis(l), stats.kurtosis(lf), stats.kurtosis(a),
      stats.kurtosis(af))
print('tmean:', stats.tmean(a, (5, 17)), stats.tmean(af, (5, 17)))
print('tvar:', stats.tvar(a, (5, 17)), stats.tvar(af, (5, 17)))
예제 #2
0
def median(an_array):
    from statlib import stats
    return stats.median(an_array)
예제 #3
0
def median(values):
    try:
        return stats.median(values)
    except (ValueError, UnboundLocalError):
        return None
예제 #4
0
def median(an_array):
    from statlib import stats
    return stats.median(an_array)
예제 #5
0
import numpy
N=numpy

l = range(1,21)
lf = range(1,21)
lf[2] = 3.0
a = N.array(l)
af = N.array(lf)
ll = [l]*5
aa = N.array(ll)

print '\nCENTRAL TENDENCY'
print 'geometricmean:',stats.geometricmean(l), stats.geometricmean(lf), stats.geometricmean(a), stats.geometricmean(af)
print 'harmonicmean:',stats.harmonicmean(l), stats.harmonicmean(lf), stats.harmonicmean(a), stats.harmonicmean(af)
print 'mean:',stats.mean(l), stats.mean(lf), stats.mean(a), stats.mean(af)
print 'median:',stats.median(l),stats.median(lf),stats.median(a),stats.median(af)
print 'medianscore:',stats.medianscore(l),stats.medianscore(lf),stats.medianscore(a),stats.medianscore(af)
print 'mode:',stats.mode(l),stats.mode(a)

print '\nMOMENTS'
print 'moment:',stats.moment(l),stats.moment(lf),stats.moment(a),stats.moment(af)
print 'variation:',stats.variation(l),stats.variation(a),stats.variation(lf),stats.variation(af)
print 'skew:',stats.skew(l),stats.skew(lf),stats.skew(a),stats.skew(af)
print 'kurtosis:',stats.kurtosis(l),stats.kurtosis(lf),stats.kurtosis(a),stats.kurtosis(af)
print 'tmean:',stats.tmean(a,(5,17)),stats.tmean(af,(5,17))
print 'tvar:',stats.tvar(a,(5,17)),stats.tvar(af,(5,17))
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)
예제 #6
0
#            print "before winnings s1 = %s, s2 = %s, s3 = %s" % (stake1, stake2, stake3)
            # Check the winnings
            win1 = across.check_winnings(verbose=False)
            if win1:
                stake1 += win1
            win2 = six_eight.check_winnings(verbose=False)
            if win2:
                stake2 += win2
            win3 = come.check_winnings(verbose=False)
            if win3:
                stake3 += win3
#            print "Roll<%s> s1 = %s, s2 = %s, s3 = %s" % (i, stake1, stake2, stake3)
            # make sure all come bets have odds
            for c_b in come.come_bets_wo_odds():
                if come.play_come_bet_odds(c_b, line_odds):
                    stake3 -= line_odds
                    if debug:
                        print "Come: come bet odds of %s on %s" % (line_odds, c_b)
            num_come_bets = come.num_come_bets()
            
        print "Ending Profits p1: %d, p2: %d p3: %d" % ((stake1 - atm1), (stake2 - atm2), (stake3 - atm3))
        profits1.append(stake1 - atm1)
        profits2.append(stake2 - atm2)
        profits3.append(stake3 - atm3)
       
#    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 across (min, mean, max) = (%s, %.2f, %.2f, %s)" % (min(profits1), stats.median(profits1), stats.mean(profits1), max(profits1))
    print "Profits 6 and 8 (min, mean, max) = (%s, %.2f, %s)" % (min(profits2), stats.mean(profits2), max(profits2))
    print "Profits3 2 come bet (min, mean, max) = (%s, %.2f, %s)" % (min(profits3), stats.mean(profits3), max(profits3))
예제 #7
0
파일: util.py 프로젝트: josephjo/kardboard
def median(values):
    try:
        return stats.median(values)
    except (ValueError, UnboundLocalError):
        return None
예제 #8
0
 def test_median(self):
     "Testing median"
     data = [self.L, self.LF, self.A, self.AF]
     for d in data:
         self.assertTrue(10 < stats.median(d) < 11)
예제 #9
0
        buckets["16-20"] += row['value']
    elif row['key'] <= 25:
        buckets["21-25"] += row['value']
    elif row['key'] <= 30:
        buckets["26-30"] += row['value']
    elif row['key'] <= 35:
        buckets["31-35"] += row['value']
    elif row['key'] <= 40:
        buckets["36-40"] += row['value']
    elif row['key'] <= 45:
        buckets["41-45"] += row['value']
    elif row['key'] <= 50:
        buckets["46-50"] += row['value']
    elif row['key'] <= 55:
        buckets["51-55"] += row['value']
    elif row['key'] <= 60:
        buckets["56-60"] += row['value']
    else:
        buckets["61+"] += row['value']

for t, n in sorted(buckets.items()):
  print "%s\t%d" % (t, n)

print "mean:   %.2f" % max(vals)
print "mean:   %.2f" % stats.mean(vals)
print "median: %.2f" % stats.median(vals)

f = open('/home/wli/scratch/process_time.json', 'w')
f.write(json.dumps(buckets))
f.close()
예제 #10
0
 def test_median(self):
     "Testing median"
     data = [ self.L, self.LF, self.A, self.AF  ]
     for d in data :
         self.assertTrue( 10 < stats.median( d ) < 11 )
예제 #11
0
l = range(1, 21)
lf = range(1, 21)
lf[2] = 3.0
a = N.array(l)
af = N.array(lf)
ll = [l] * 5
aa = N.array(ll)

print '\nCENTRAL TENDENCY'
print 'geometricmean:', stats.geometricmean(l), stats.geometricmean(
    lf), stats.geometricmean(a), stats.geometricmean(af)
print 'harmonicmean:', stats.harmonicmean(l), stats.harmonicmean(
    lf), stats.harmonicmean(a), stats.harmonicmean(af)
print 'mean:', stats.mean(l), stats.mean(lf), stats.mean(a), stats.mean(af)
print 'median:', stats.median(l), stats.median(lf), stats.median(
    a), stats.median(af)
print 'medianscore:', stats.medianscore(l), stats.medianscore(
    lf), stats.medianscore(a), stats.medianscore(af)
print 'mode:', stats.mode(l), stats.mode(a)

print '\nMOMENTS'
print 'moment:', stats.moment(l), stats.moment(lf), stats.moment(
    a), stats.moment(af)
print 'variation:', stats.variation(l), stats.variation(a), stats.variation(
    lf), stats.variation(af)
print 'skew:', stats.skew(l), stats.skew(lf), stats.skew(a), stats.skew(af)
print 'kurtosis:', stats.kurtosis(l), stats.kurtosis(lf), stats.kurtosis(
    a), stats.kurtosis(af)
print 'tmean:', stats.tmean(a, (5, 17)), stats.tmean(af, (5, 17))
print 'tvar:', stats.tvar(a, (5, 17)), stats.tvar(af, (5, 17))
예제 #12
0
# run in wt/visual-cluster
from statlib import stats
OFILE = open("stats.txt",'w')
for i in range(1,8):
    BEs = []
    IFILE = open("visual_cluster-%s.pdb" % i, 'r')
    for l in IFILE:
        values = l.split()
        BEs.append(float(values[9]) / 0.7) # if given BEs are weighted
    OFILE.write("visual_cluster-%s: %s, stddev %s, lower %s, upper %s, min %s, max %s, median %s \n" % (i,stats.mean(BEs), 
stats.stdev(BEs), 
stats.scoreatpercentile(BEs,25), 
stats.scoreatpercentile(BEs,75),
min(BEs), max(BEs),
stats.median(BEs) ))
OFILE.close()
    
 def evaluate(self, *args, **params):
     return _stats.median(*args, **params)