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
Пример #2
0
 def test_cumfreq(self):
     "Testing cumfreq"
     data = [ self.L, self.LF, self.A, self.AF ]
     results1 = ([2, 4, 6, 8, 10, 12, 14, 16, 18, 20], -0.045000050000000069, 2.0900001000000001, 0 )
     results2 = ([2, 4, 6, 8, 10, 12, 14, 16, 18, 20], -0.045000050000000069, 2.0900001000000001, 0 )
     results3 = (num_array([  2.,   4.,   6.,   8.,  10.,  12.,  14.,  16.,  18.,  20.]), -0.045000050000000069, 2.0900001000000001, 0 )
     results4 = (num_array([  2.,   4.,   6.,   8.,  10.,  12.,  14.,  16.,  18.,  20.]), -0.045000050000000069, 2.0900001000000001, 0 )
     
     i = 0
     for d in data:
         self.assertEqual( stats.cumfreq( d )[i], results1[i] )
         i += 1
Пример #3
0
 def test_cumfreq(self):
     "Testing cumfreq"
     data = [ self.L, self.LF, self.A, self.AF ]
     results1 = ([2, 4, 6, 8, 10, 12, 14, 16, 18, 20], -0.045000050000000069, 2.0900001000000001, 0 )
     results2 = ([2, 4, 6, 8, 10, 12, 14, 16, 18, 20], -0.045000050000000069, 2.0900001000000001, 0 )
     results3 = (num_array([  2.,   4.,   6.,   8.,  10.,  12.,  14.,  16.,  18.,  20.]), -0.045000050000000069, 2.0900001000000001, 0 )
     results4 = (num_array([  2.,   4.,   6.,   8.,  10.,  12.,  14.,  16.,  18.,  20.]), -0.045000050000000069, 2.0900001000000001, 0 )
     
     i = 0
     for d in data:
         self.assertEqual( stats.cumfreq( d )[i], results1[i] )
         i += 1
Пример #4
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
 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
Пример #6
0
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))
a = N.array(l)
ll = [l] * 5
Пример #7
0
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)
a = N.array(l)
ll = [l]*5
 def evaluate(self, *args, **params):
     return _stats.cumfreq(*args, **params)
Пример #9
0
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)
a = N.array(l)
ll = [l] * 5