<jupyter_start><jupyter_text>1. Counting unique users:  '<NAME>', '<NAME>', '<NAME>' and '<NAME>'<jupyter_code>song_data = graphlab.SFrame('song_data.gl/')
song_data.head()
graphlab.canvas.set_target('ipynb')
len(song_data[song_data['artist'] == '<NAME>'].unique())
len(song_data[song_data['artist'] == '<NAME>'].unique())
len(song_data[song_data['artist'] == '<NAME>'].unique())
len(song_data[song_data['artist'] == '<NAME>'].unique())<jupyter_output><empty_output><jupyter_text>2. Using groupby-aggregate to find the most popular and least popular artist:<jupyter_code>song_data_groupby = song_data.groupby(key_columns='artist', operations={'total_count': graphlab.aggregate.SUM('listen_count')})
song_data_groupby.head()
song_data_groupby_de = song_data_groupby.sort('total_count',ascending=False)
song_data_groupby_de.head()
song_data_groupby_de[0]
song_data_groupby_as = song_data_groupby.sort('total_count',ascending=True)
song_data_groupby_as.head()
song_data_groupby_as[0]<jupyter_output><empty_output><jupyter_text>3. Using groupby-aggregate to find the most recommended songs:<jupyter_code>train_data,test_data = song_data.random_split(.8,seed=0)
personalized_model = graphlab.item_similarity_recommender.create(train_data,
                                                                user_id='user_id',
                                                                item_id='song')
subset_test_users = test_data['user_id'].unique()[0:10000]
subset_test_users.head()
personalized_model_recommend = personalized_model.recommend(subset_test_users,k=1)
personalized_model_recommend.head()
personalized_model_recommend_groupby = personalized_model_recommend.groupby(key_columns='song',operations={'count': graphlab.aggregate.COUNT()})
personalized_model_recommend_groupby.head()
personalized_model_recommend_groupby_de = personalized_model_recommend_groupby.sort('count',ascending=False)
personalized_model_recommend_groupby_de.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13272543059777103, 'fraction_numerical': 0.0070921985815602835, 'mean_word_length': 6.931726907630522, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '314880', 'license': 'MIT', 'n_tokens_mistral': 696, 'n_tokens_neox': 656, 'n_words': 69, 'path': 'Week 5 PA 1/Week+5.ipynb', 'repo_name': 'Drishtant-Shri/Coursera-UW-Machine-Learning-Foundations-A-Case-Study-Approach', 'size': '2012'}