def test_expert_finder_topic_modeling(): alpha = np.ones(k) beta = np.ones(a) gamma = np.ones((k, v)) omega = np.ones((k, p)) toy_expert_finder = ef.ExpertFinder( K=k, docs_meta=docs, P=p, A=a, V=v, alpha=alpha, beta=beta, gamma=gamma, omega=omega, ) ef.expert_finding_learning(toy_expert_finder, 3000)
def test_expert_finder_hierarchy_rocks(): alpha = np.ones(k) #may try different topic distribution beta = np.ones(a) #authors - uniform gamma = np.ones((k,v)) back_phrase_prob = 1.0 / p background_topic_dist = [back_phrase_prob] * p fpm_topic_dist = generate_phrase_topic_dist(PHRASE_DIST_PATH + 'frequent_pattern_mining', 27451, 0.4) ds_topic_dist = generate_phrase_topic_dist(PHRASE_DIST_PATH + 'data_stream', 27451, 0.4) phrase_dist = [background_topic_dist, fpm_topic_dist, ds_topic_dist] toy_expert_finder = ef.ExpertFinder( K=k, docs_meta=docs, P=p, A=a, V=v, alpha=alpha, beta=beta, gamma=gamma, dist_phrase=phrase_dist, ) ef.expert_finding_learning(toy_expert_finder, 3000)
def test_expert_finder_hits(): alpha = np.ones(k) #may try different topic distribution beta = np.ones(a) #authors - uniform gamma = np.array([[1,1,1,1,1,1,1,1,1,1], [1,100,50,30,1,1,1,1,1,1], [1,1,1,1,1,1,100,70,1,1]]) back_phrase_prob = 1.0 / p background_topic_dist = [back_phrase_prob] * p fpm_topic_dist = generate_phrase_topic_dist(PHRASE_DIST_PATH + 'frequent_pattern_mining', 27451, 0.4) ds_topic_dist = generate_phrase_topic_dist(PHRASE_DIST_PATH + 'data_stream', 27451, 0.4) phrase_dist = [background_topic_dist, fpm_topic_dist, ds_topic_dist] toy_expert_finder = ef.ExpertFinder( K=k, docs_meta=docs, P=p, A=a, V=v, alpha=alpha, beta=beta, gamma=gamma, dist_phrase=phrase_dist, ) ef.expert_finding_learning(toy_expert_finder, 200) toy_hin = build_hin.HIN(docs_meta=docs) toy_hits_1 = hits.HITS(toy_expert_finder, 1, toy_hin) #toy_hits_2 = bibrank.HITS(toy_expert_finder, 2, toy_hin) hits.propagate_with_hits(toy_hits_1, 300) #bibrank.propagate_with_hits(toy_hits_2, 300) print "auth papers" print toy_hits_1.auth_papers print "hub papers" print toy_hits_1.hub_papers print "auth authors" print toy_hits_1.auth_authors print "auth venues" print toy_hits_1.auth_venues