def testcategorialHistogramm(self): k = histogramm() for i in xrange(100000): dict = {"c1" : random.uniform(0,1.1), "c2" : random.uniform(0,1), "c3" : random.uniform(0,1), "c4" : random.uniform(0,1) } k.binify_categorial(dict) catHistogram = k.get_histogramm(sorted = False) print catHistogram
def testNominalHistogramm(self): h = histogramm() r = [] for i in xrange(20000): r_ = random.gauss(1,0.1) while ( h.maxx < r_ or h.minx > r_ ): r_ = random.gauss(1,1) # r.append( random.uniform(0,1) ) r.append( r_ ) h.binify_real(r) print h.get_histogramm()
def test_random_prefer_older(self): random_prefer_older_recommender = random_prefer_base(1) ignores = [] h = histogramm.histogramm() for i in xrange(10000): recs = random_prefer_older_recommender.get_recommendation(4, 123, ignores) h.binify_categorial( recs ) recs = h.get_histogramm() print "histogram of recommended items. an older item should have a much higher score then an older one \n" print recs