Beispiel #1
0
def user_sim_matrix(path,matrix1=user_topics.get_topic_sim_matrix(),matrix2=user_tags.get_tag_sim_matrix()):
  # topic_matrix = user_topics.get_topic_sim_matrix()
  # tag_matrix = user_tags.get_tag_sim_matrix()
  topic_matrix = matrix1
  tag_matrix = matrix2
  sim_matrix = {}
  for m in topic_matrix:
    if m in tag_matrix:
      sim_matrix[m] = topic_matrix[m]*(tag_matrix[m]+0.001)
  # json.dump(sim_matrix,open("matrix/100_sim_matrix.txt",'w'))
  json.dump(sim_matrix,open(path,'w'))
  return sim_matrix
Beispiel #2
0
def user_sim_matrix(path,
                    matrix1=user_topics.get_topic_sim_matrix(),
                    matrix2=user_tags.get_tag_sim_matrix()):
    # topic_matrix = user_topics.get_topic_sim_matrix()
    # tag_matrix = user_tags.get_tag_sim_matrix()
    topic_matrix = matrix1
    tag_matrix = matrix2
    sim_matrix = {}
    for m in topic_matrix:
        if m in tag_matrix:
            sim_matrix[m] = topic_matrix[m] * (tag_matrix[m] + 0.001)
    # json.dump(sim_matrix,open("matrix/100_sim_matrix.txt",'w'))
    json.dump(sim_matrix, open(path, 'w'))
    return sim_matrix
Beispiel #3
0
def main():
  user_sim_matrix(path="matrix/topic_item_hybrid_matrix.txt",matrix1=user_topics.get_topic_sim_matrix(),matrix2=user_items.get_user_items_sim_matrix())
Beispiel #4
0
def main():
    user_sim_matrix(path="matrix/topic_item_hybrid_matrix.txt",
                    matrix1=user_topics.get_topic_sim_matrix(),
                    matrix2=user_items.get_user_items_sim_matrix())