Example #1
0
clustered_approach_online = cluster1 + cluster2 + cluster3 + cluster4

ensembled1 = sps.load_npz(
    ROOT_DIR + '/final_npz_creative/ensembled_CREATIVE_online_half1.npz')
ensembled2 = sps.load_npz(
    ROOT_DIR + '/final_npz_creative/ensembled_CREATIVE_online_half2.npz')

ensembled = ensembled1 + ensembled2

####### POSTPROCESSING #################################################################

# COMBINE
eurm_ens = combine_two_eurms(clustered_approach_online,
                             ensembled,
                             cat_first=[3, 4, 5, 8, 10])
sim = generate_similarity('online')

# HOLEBOOST
hb = HoleBoost(similarity=sim, eurm=eurm_ens, datareader=dr, norm=norm_l1_row)
eurm_ens = hb.boost_eurm(categories=[8], k=300, gamma=1)
hb = HoleBoost(similarity=sim, eurm=eurm_ens, datareader=dr, norm=norm_l1_row)
eurm_ens = hb.boost_eurm(categories=[10], k=150, gamma=1)

# TAILBOOST
tb = TailBoost(similarity=sim, eurm=eurm_ens, datareader=dr, norm=norm_l2_row)
eurm_ens = tb.boost_eurm(categories=[9, 7, 6, 5],
                         last_tracks=[10, 3, 3, 3],
                         k=[100, 80, 100, 100],
                         gamma=[0.01, 0.01, 0.01, 0.01])

# ALBUMBOOST
Example #2
0
        eurm_list.append(eurm)

    CLUSTERED_MATRIX = eurm_list[0]+eurm_list[1]+eurm_list[2]+eurm_list[3]

    ev = Evaluator(dr)
    ev.evaluate(recommendation_list=eurm_to_recommendation_list(CLUSTERED_MATRIX), name='clustered_offline')

    ENSEMBLED = eurm_list[4]

    ev.evaluate(recommendation_list=eurm_to_recommendation_list(ENSEMBLED), name='ensembled_offline')

    ####### POSTPROCESSING #################################################################

    # COMBINE
    FINAL = combine_two_eurms(CLUSTERED_MATRIX, ENSEMBLED, cat_first=[3, 4, 5, 8, 10])
    sim = generate_similarity('offline')

    # HOLEBOOST
    hb = HoleBoost(similarity=sim, eurm=FINAL, datareader=dr, norm=norm_l1_row)
    FINAL = hb.boost_eurm(categories=[8], k=300, gamma=1)
    hb = HoleBoost(similarity=sim, eurm=FINAL, datareader=dr, norm=norm_l1_row)
    FINAL = hb.boost_eurm(categories=[10], k=150, gamma=1)

    # TAILBOOST
    tb = TailBoost(similarity=sim, eurm=FINAL, datareader=dr, norm=norm_l2_row)
    FINAL = tb.boost_eurm(categories=[9, 7, 6, 5],
                             last_tracks=[10, 3, 3, 3],
                             k=[100, 80, 100, 100],
                             gamma=[0.01, 0.01, 0.01, 0.01])

    # ALBUMBOOST