Finding similarity based on BoW

Viewed 10

To Do: Find courses which are similar to course_id = 'ML0101ENv3'

Instructions: For each course other than ML0101ENv3, use pivot_course_rows to convert it with course ML0101ENv3 into horizontal two BoW feature vectors. Then use the cosine method to calculate the similarity. Report all courses with similarities larger than a specific threshold (such as 0.5)

    ml_python = bows_df[bows_df['doc_id'] == 'ML0101ENv3']
    ml_not_python = bows_df[bows_df['doc_id']!= 'ML0101ENv3']


    bow_vectors = pivot_two_bows(ml_not_python, ml_python)
    similarity = 1 - cosine((bow_vectors['doc_id']!='ML0101ENv3'), 
                            (bow_vectors['doc_id']=='ML0101ENv3'))
    similarity       

similarity returns 0.0

0 Answers
Related