cumulative=False, normed=True, label=['pos', 'neg']) ax2.legend() plt.show() if __name__ == '__main__': yc = ConfigParser.ConfigParser() yc.read(CONFIG) sfx = yc.get('Path', 'yep_data_class') st = Stat(user_base = Utility.load_user_filtered(L_USER_F + sfx), # specify user base user_label = Utility.load_user_label(R_USER_LABEL + sfx)) # specify user label # st.co_review_num_dist(Utility.load_user_buz_rating(R_USER_BUZ_RATING + sfx)) # st.co_review_rating_dev_dist(Utility.load_user_buz_rating(R_USER_BUZ_RATING + sfx)) # st.knn_sim_distribution(np.iinfo(np.int64).max, Yelp.load_sim_mat(SM_COMMON_FRIEND + sfx)) # st.knn_sim_distribution(10, Yelp.load_sim_mat(SM_COMMON_FRIEND + sfx)) # st.knn_sim_distribution(5, Yelp.load_sim_mat(SM_COMMON_FRIEND + sfx)) # st.knn_sim_distribution(2, Yelp.load_sim_mat(SM_COMMON_FRIEND + sfx)) # st.knn_sim_distribution(1, Yelp.load_sim_mat(SM_COMMON_FRIEND + sfx)) # st.knn_sim_distribution(np.iinfo(np.int64).max, Yelp.load_sim_mat(SM_RATING_DEVIATION + sfx)) # st.knn_sim_distribution(np.iinfo(np.int64).max, Yelp.load_sim_mat(SM_COREVIEW_RATIO + sfx)) # st.knn_sim_distribution(1, Yelp.load_sim_mat(SM_COREVIEW_RATIO + sfx))
return sm @staticmethod def show_mat(sm): # print sm plt.spy(sm, marker='.', precision=0.1, markersize=5) plt.show() if __name__ == '__main__': yc = ConfigParser.ConfigParser() yc.read(CONFIG) sfx = yc.get('Path', 'yep_data_class') # indicate which yelp dataset is used - _boston or _SanFrancisco y = Yelp(sfx = sfx, # specify dataset class user_base = Utility.load_user_filtered(L_USER_F + sfx)) # specify user base #=============================================================================== # Generate Simialrity Matrix #=============================================================================== # 1) Common Friend # user_friend = Utility.load_user_friends(R_USER_FRIEND + sfx) # y.gen_sim_mat(Yelp.pf_common_friend, SM_COMMON_FRIEND + sfx , (user_friend,)) # 2) Rating Deviation # user_buz_rating = Utility.load_user_buz_rating(R_USER_BUZ_RATING + sfx) # y.gen_sim_mat(Yelp.pf_rating_deviation, SM_RATING_DEVIATION + sfx , (user_buz_rating,)) # 3) Co-review ratio # user_buz_rating = Utility.load_user_buz_rating(R_USER_BUZ_RATING + sfx) # y.gen_sim_mat(Yelp.pf_co_review_ratio, SM_COREVIEW_RATIO + sfx, (user_buz_rating,))