<jupyter_start><jupyter_text>Build a song recommender system<jupyter_code>import turicreate<jupyter_output><empty_output><jupyter_text>Load some music data<jupyter_code>song_data = turicreate.SFrame('song_data.sframe')<jupyter_output><empty_output><jupyter_text>Explore our data<jupyter_code>song_data<jupyter_output><empty_output><jupyter_text>Show the most popular songs in the dataset<jupyter_code>song_data['song'].show()<jupyter_output><empty_output><jupyter_text>Count the number of unique users in the data<jupyter_code>users = song_data['user_id'].unique()
len(users)<jupyter_output><empty_output><jupyter_text>Create a song recommender<jupyter_code>train_data,test_data = song_data.random_split(.8,seed=0)<jupyter_output><empty_output><jupyter_text>Create a very simple popularity recommender<jupyter_code>popularity_model = turicreate.popularity_recommender.create(train_data,
                                                           user_id = 'user_id',
                                                           item_id = 'song')<jupyter_output><empty_output><jupyter_text>Use the popularity model to make some predictions<jupyter_code>popularity_model.recommend(users=[users[0]])
popularity_model.recommend(users=[users[1]])<jupyter_output><empty_output><jupyter_text>Build a recommender with personalization<jupyter_code>personalized_model = turicreate.item_similarity_recommender.create(train_data,
                                                                  user_id = 'user_id',
                                                                  item_id = 'song')<jupyter_output><empty_output><jupyter_text>Apply personalized model to make song recommendations<jupyter_code>personalized_model.recommend(users=[users[0]])
personalized_model.recommend(users=[users[1]])<jupyter_output><empty_output><jupyter_text>Apply model to find similar songs in the data set<jupyter_code>personalized_model.get_similar_items(['With Or Without You - U2'])
personalized_model.get_similar_items(['<NAME> (Live) - Buena Vista Social Club'])<jupyter_output><empty_output><jupyter_text>Compare the models quantitativelyWe now formally compare the popularity and the personalized models using precision-recall curves.<jupyter_code>model_performance = turicreate.recommender.util.compare_models(test_data, [popularity_model, personalized_model], user_sample=.05)<jupyter_output>compare_models: using 2931 users to estimate model performance
PROGRESS: Evaluate model M0
{'fraction_non_alphanumeric': 0.0903199675982179, 'fraction_numerical': 0.005670311867152693, 'mean_word_length': 5.144278606965174, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '83736', 'license': 'MIT', 'n_tokens_mistral': 773, 'n_tokens_neox': 740, 'n_words': 116, 'path': 'Song_Recommender_System.ipynb', 'repo_name': 'iamdas3/Song-recommender', 'size': '2472'}