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 'mean:', stats.mean(a), stats.mean(af) print 'var:', stats.var(a), stats.var(af) print 'stdev:', stats.stdev(a), stats.stdev(af) print 'sem:', stats.sem(a), stats.sem(af)
pass 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('mean:',stats.mean(a),stats.mean(af)) print('var:',stats.var(a),stats.var(af)) print('stdev:',stats.stdev(a),stats.stdev(af)) print('sem:',stats.sem(a),stats.sem(af)) print('describe:') print(stats.describe(l)) print(stats.describe(lf)) print(stats.describe(a)) print(stats.describe(af))
loc2 = reverse_geocode.county_lookup(lat2, long2, strict=True) state2 = None if loc2 is None: print>>sys.stderr, "no county for prediction %s,%s" % (lat2,long2) state2 = "WTF" import state_codes state1 = state_codes.fips2postal[loc1.statefp] state2 = state2 or state_codes.fips2postal[loc2.statefp] region1 = regions.StateRegion.get(state1, "WTF") region2 = regions.StateRegion.get(state2, "WTF") corrects['state'].append( int(state1 == state2) ) #corrects['div'].append( int(div1 == div2) ) corrects['region'].append( int(region1 == region2) ) #corrects['metro'].append( int(metro1==metro2) ) print "\t".join(str(x) for x in [km,state1,state2, region1, region2]) print "--" print "mean_dist_km %f" % mean(dists) print "med_dist_km %f" % medianscore(dists) print "state_acc %f" % mean(corrects['state']) #print "div_acc %f" % mean(corrects['div']) print "region_acc %f" % mean(corrects['region']) # print "metro_acc %f" % mean(corrects['metro']) # vim:foldmethod=marker