Exemplo n.º 1
0
    try:
        file, pathname, description = find_module(algo, ['rating_algo'])
        assert file
        ratingalgorithm = load_module(algo, file, pathname, description).__dict__[algo]
    except Exception, e:
        raise e    
    
    if normalize: 
        newcolumniter = normalizeCol( ratingalgorithm(file=originalfile) )
    else: 
        newcolumniter = ratingalgorithm(file=originalfile) 
    
    
    WriteNewColOnCsv(newfield, newcolumniter, newfile, originalfile)    
    JCR = JamendoCsvReader(newfile)
    
    printChart(JCR, chartN, newfield, oldfield )
    

    if int(plot):
        
        plot_rating_stats(JCR, oldfield, title=oldfield, show=False, nozero=nozero)
        plot_rating_stats(JCR, newfield, title=newfield, show=False, nozero=nozero)

        compareJCRColumns(JCR, [oldfield, 'weighted_avg_agreed_note', newfield], sortkey=newfield, \
                          title='comparare %s and %s (values aligned by same ids)' % (oldfield, newfield))
               

test_algo(*argv[1:])

from sys import path
path.append('../')

from core.JamendoCsvReader import JamendoCsvReader  
from core.JamendoPlotFuncs import plot_rating_stats


plot_rating_stats(JamendoCsvReader('stats_album_total.csv'), 'rating', title='stats_album_total rating statistics', show=False)
plot_rating_stats(JamendoCsvReader('stats_track_total.csv'), 'rating', title='stats_track_total rating statistics', show=False)
plot_rating_stats(JamendoCsvReader('stats_artist_total.csv'), 'rating', title='stats_artist_total rating statistics')