Пример #1
0
 def test_itemfreq(self):
     "Testing itemfreq"
     self.assertEqual(
         stats.itemfreq(self.L),
         [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1],
          [9, 1], [10, 1], [11, 1], [12, 1], [13, 1], [14, 1], [15, 1],
          [16, 1], [17, 1], [18, 1], [19, 1], [20, 1]])
 def stats_per_second(self, *args):
     superstats = []
     for game_log, matrix in args:
         cstats = corestats.Stats()
         stats = {}
         mode = cstats.mode(matrix)
         stats['mode'] = mode[0][0]
         stats['modenext'] = mode[1][0]
         stats['mean'] = cstats.mean(matrix)
         stats['median'] = cstats.median(matrix)
         #stats['harmonicmean'] = mstats.harmonicmean(matrix)
         stats['variance'] = cstats.variance(matrix)
         stats['stddeviation'] = stats['variance'] ** 0.5
         stats['3sigma'] = 3*stats['stddeviation']
         stats['cumfreq'] = mstats.cumfreq(matrix)
         stats['itemfreq'] = mstats.itemfreq(matrix) # frequency of each item (each item being the count of the occurrencies for each number of lines per second)
         stats['min'] = min(matrix)
         stats['max'] = max(matrix)
         stats['samplespace'] = stats['max'] - stats['min']
         stats['count'] = len(matrix)
         stats['kurtosis'] = mstats.kurtosis(matrix)
         stats['perfectvalue'] = int(math.ceil(stats['3sigma'] + stats['mean']))
         stats['perfectscore'] = cstats.percentileforvalue(matrix, math.ceil(stats['3sigma'] + stats['mean']))
         scorepercentiles = [10, 30, 50, 70, 80, 85, 90, 95, 99, 99.9, 99.99]
         stats['itemscore'] = [(percentile, cstats.valueforpercentile(matrix, percentile)) for percentile in scorepercentiles]
         stats['skew'] = mstats.skew(matrix) # if positive, there are more smaller than higher values from the mean. If negative, there are more higher than smaller values from the mean.
         if stats['skew'] > 0:
             stats['skewmeaning'] = 'There exist more smaller values from the mean than higher'
         else:
             stats['skewmeaning'] = 'There exist more higher values from the mean than smaller'
         superstats.append( (game_log, stats) )
     return superstats
 def stats_per_second(self, *args):
     superstats = []
     for game_log, matrix in args:
         cstats = corestats.Stats()
         stats = {}
         mode = cstats.mode(matrix)
         stats['mode'] = mode[0][0]
         stats['modenext'] = mode[1][0]
         stats['mean'] = cstats.mean(matrix)
         stats['median'] = cstats.median(matrix)
         #stats['harmonicmean'] = mstats.harmonicmean(matrix)
         stats['variance'] = cstats.variance(matrix)
         stats['stddeviation'] = stats['variance']**0.5
         stats['3sigma'] = 3 * stats['stddeviation']
         stats['cumfreq'] = mstats.cumfreq(matrix)
         stats['itemfreq'] = mstats.itemfreq(
             matrix
         )  # frequency of each item (each item being the count of the occurrencies for each number of lines per second)
         stats['min'] = min(matrix)
         stats['max'] = max(matrix)
         stats['samplespace'] = stats['max'] - stats['min']
         stats['count'] = len(matrix)
         stats['kurtosis'] = mstats.kurtosis(matrix)
         stats['perfectvalue'] = int(
             math.ceil(stats['3sigma'] + stats['mean']))
         stats['perfectscore'] = cstats.percentileforvalue(
             matrix, math.ceil(stats['3sigma'] + stats['mean']))
         scorepercentiles = [
             10, 30, 50, 70, 80, 85, 90, 95, 99, 99.9, 99.99
         ]
         stats['itemscore'] = [
             (percentile, cstats.valueforpercentile(matrix, percentile))
             for percentile in scorepercentiles
         ]
         stats['skew'] = mstats.skew(
             matrix
         )  # if positive, there are more smaller than higher values from the mean. If negative, there are more higher than smaller values from the mean.
         if stats['skew'] > 0:
             stats[
                 'skewmeaning'] = 'There exist more smaller values from the mean than higher'
         else:
             stats[
                 'skewmeaning'] = 'There exist more higher values from the mean than smaller'
         superstats.append((game_log, stats))
     return superstats
Пример #4
0
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))
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))
Пример #5
0
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)
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)
 def evaluate(self, *args, **params):
     return _stats.itemfreq(*args, **params)
Пример #7
0
 def test_itemfreq(self):
     "Testing itemfreq"
     self.assertEqual( stats.itemfreq( self.L ), [[1, 1], [2, 1], [3, 1], [4, 1], [5, 1], [6, 1], [7, 1], [8, 1], [9, 1], [10, 1], [11, 1], [12, 1], [13, 1], [14, 1], [15, 1], [16, 1], [17, 1], [18, 1], [19, 1], [20, 1]] )
Пример #8
0
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)
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)