├── instagram auth share.txt ├── instagram_api_simple.py ├── social_apis_blanks.py ├── README.md └── Last.Fm Artist Recommeder.ipynb /instagram auth share.txt: -------------------------------------------------------------------------------- 1 | Implicit Flow 2 | https://api.instagram.com/oauth/authorize/?client_id=&redirect_uri=http://tech.cornell.edu&response_type=token 3 | 4 | Authorization Flow 5 | 6 | https://api.instagram.com/oauth/authorize/?client_id=&redirect_uri=http://tech.cornell.edu&response_type=code 7 | 8 | https://api.instagram.com/oauth/authorize/?client_id=&redirect_uri=http://tech.cornell.edu&response_type=code 9 | &scope=basic 10 | 11 | https://api.instagram.com/oauth/authorize/?client_id=&redirect_uri=http://tech.cornell.edu&response_type=code 12 | &scope=likes+comments 13 | 14 | curl -k \-F 'client_id=' \ 15 | -F 'client_secret=' \ 16 | -F 'grant_type=authorization_code' \ 17 | -F 'redirect_uri=http://tech.cornell.edu' \ 18 | -F 'code=' \https://api.instagram.com/oauth/access_token 19 | 20 | 21 | OR (Implicit Flow) 22 | https://api.instagram.com/oauth/authorize/?client_id=&redirect_uri=http://tech.cornell.edu&response_type=token 23 | 24 | then 25 | curl -k hhttps://api.instagram.com/v1/users/self/media/recent/?access_token= 26 | or 27 | curl -k hhttps://api.instagram.com/v1/users/self/media/recent/?access_token= > my_feed.txt 28 | 29 | Other types of data: 30 | Media search (photos near Cornell Tech) 31 | curl -k "https://api.instagram.com/v1/locations/search?lat=40.741&lng=-74.002&access_token=" 32 | 33 | -------------------------------------------------------------------------------- /instagram_api_simple.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/python 2 | 3 | # Simple Instagram example 4 | # Make sure to git clone https://github.com/Instagram/python-instagram into the directory you are working on. 5 | 6 | import sys 7 | #import simplejson as json 8 | from instagram.client import InstagramAPI 9 | from instagram import InstagramAPIError 10 | from datetime import datetime 11 | 12 | 13 | client_id = "XXXXX" 14 | client_secret = "YYYYYY" 15 | access_token = "ZZZZZ" 16 | 17 | CRAWL_RADIUS = 5000 18 | 19 | def crawl_locations(points): 20 | api = InstagramAPI(access_token=access_token) 21 | 22 | for point in points: 23 | print("Media search for %s,%s"%(point['lat'],point['lng'])) 24 | try: 25 | crawled_media = api.media_search(lat=point['lat'],lng=point['lng'], distance=CRAWL_RADIUS) 26 | except InstagramAPIError as ie: 27 | print("Instagram API error" + str(ie)) 28 | return 29 | except Exception as e: 30 | print("General exception" + str(e)) 31 | return 32 | 33 | for media in crawled_media: 34 | print media, media.user, media.images['thumbnail'].url 35 | print "++" 36 | 37 | print ("Got %d results\n"%len(crawled_media)) 38 | 39 | if len(crawled_media) > 0: 40 | latest_id = crawled_media[0].id 41 | print "Latest result ID:", latest_id 42 | 43 | 44 | def crawl_own(): 45 | api = InstagramAPI(access_token=access_token) 46 | 47 | try: 48 | #recent_media, next_ = api.user_recent_media(user_id="mmoorr", count=10) 49 | media_feed, next_ = api.user_media_feed(count=20) 50 | except InstagramAPIError as ie: 51 | print("Instagram API error" + str(ie)) 52 | return 53 | except Exception as e: 54 | print("General exception" + str(e)) 55 | return 56 | 57 | for media in media_feed: 58 | print media.user 59 | if media.caption: 60 | print media.caption.text 61 | print "++" 62 | 63 | def crawl_all_feeders(): 64 | api = InstagramAPI(access_token=access_token) 65 | 66 | try: 67 | #recent_media, next_ = api.user_recent_media(user_id="mmoorr", count=10) 68 | media_feed, next_ = api.user_media_feed(count=20) 69 | except InstagramAPIError as ie: 70 | print("Instagram API error" + str(ie)) 71 | return 72 | except Exception as e: 73 | print("General exception" + str(e)) 74 | return 75 | 76 | crawled={} 77 | for media in media_feed: 78 | if media.user.id in crawled: continue 79 | crawled[media.user.id] = True 80 | try: 81 | recent_media, next_ = api.user_recent_media(user_id=media.user.id, count=10) 82 | user_info = api.user(user_id=media.user.id) 83 | except InstagramAPIError as ie: 84 | print("Instagram API error" + str(ie)) 85 | return 86 | except Exception as e: 87 | print("General exception" + str(e)) 88 | return 89 | print ("Got %d items for user %s"%(len(recent_media), media.user)) 90 | print ("This is %s, ID %s, bio %s, followed by %s"%(user_info.full_name, 91 | user_info.id, 92 | user_info.bio, 93 | user_info.counts['followed_by'])) 94 | print ("++") 95 | 96 | if __name__ == '__main__': 97 | 98 | if (len(sys.argv) != 3): 99 | print "No argument, getting my own photos!" 100 | crawl_own() 101 | crawl_all_feeders() 102 | else: 103 | lat, lng = float(sys.argv[1]), float(sys.argv[2]) 104 | crawl_locations([{"lat" : lat, "lng" : lng}]) 105 | 106 | 107 | -------------------------------------------------------------------------------- /social_apis_blanks.py: -------------------------------------------------------------------------------- 1 | 1. Generate an oauth token by: 2 | curl -i -u your_username -d '{"scopes": ["repo", "gist", "notifications", "user"], "note": "getting-started"}' https://api.github.com/authorizations 3 | or by going to: https://github.com/settings/tokens/new (select all but the admin categories and delete_repo) 4 | 2. Check access: 5 | curl -i -H 'Authorization: token GITHUB_TOKEN' https://api.github.com/user 6 | 3. Browse to docs: http://pygithub.readthedocs.org/en/stable/github.html and https://developer.github.com/v3/ 7 | 8 | # view user repos 9 | curl -i -H 'Authorization: token GITHUB_TOKEN' https://api.github.com/___1 10 | 11 | # view user owned repos 12 | curl -i -H 'Authorization: token GITHUB_TOKEN' https://api.github.com/___2 13 | 14 | # repo events 15 | curl -i -H 'Authorization: token GITHUB_TOKEN' https://api.github.com/___3 16 | 17 | # repo push events 18 | curl -i -H 'Authorization: token GITHUB_TOKEN' https://api.github.com/___4 19 | 20 | ########################### 21 | # PYTHON (requires PyGithub) 22 | 23 | from github import Github 24 | g = Github('GITHUB_TOKEN') 25 | 26 | # get user info 27 | u = g.___5 28 | # print raw user info 29 | print u.___6 30 | # print user id, name, number of public repos 31 | print ___7 32 | 33 | # get user repos 34 | for repo in ___8: 35 | # print repo name 36 | print ___9 37 | 38 | # get specific repo activity 39 | for e in ___10.get_events(): 40 | # print event time, user and type 41 | print ___11 42 | 43 | ########################### 44 | # Instagram 45 | 1. Go to https://www.instagram.com/developer create app, uncheck implicit premission 46 | 2. Browse to https://api.instagram.com/oauth/authorize/?client_id=&redirect_uri=http://localhost&response_type=token&scope=basic+likes+comments+follower_list+public_content 47 | 3. Check access: 48 | curl https://api.instagram.com/v1/users/self/?access_token=INSTAGRAM_TOKEN 49 | Alternatively, get token from https://apigee.com/embed/console/instagram 50 | 4. Browse to docs: https://github.com/Instagram/python-instagram and https://www.instagram.com/developer/endpoints/ 51 | 52 | # apigee 53 | api = InstagramAPI(access_token="INSTAGRAM_TOKEN") 54 | 55 | # get user info 56 | u = ___12 57 | # print user id, username, full name 58 | print ___13 59 | # print activity counts 60 | print ___14 61 | 62 | # get followers 63 | followers, next_ = api.___15 64 | while next_: 65 | more_followers, next_ = api.user_followed_by(with_next_url=next_) 66 | followers.extend(more_followers) 67 | 68 | # get followees 69 | followees, next_ = api.___16 70 | while next_: 71 | more_followees, next_ = api.___17(with_next_url=next_) 72 | followees.extend(more_followees) 73 | 74 | # intersect followers and followees 75 | set([f.username for f in followers]) & set([f.username for f in followees]) 76 | 77 | # get user feed 78 | media_feed, next_ = api.___18(count=20) 79 | for media in media_feed: 80 | # print media's user 81 | print ___19 82 | # print caption 83 | if ___20: 84 | print ___20 85 | print "++" 86 | 87 | # get followed people media and info 88 | crawled={} 89 | for media in media_feed: 90 | if media.user.id in crawled: 91 | ___21 92 | crawled[media.user.id] = True 93 | # friend's recent media 94 | recent_media, next_ = api.user_recent_media(___1, count=10) 95 | # friend's info 96 | user_info = api.user(___2) 97 | # print number of media elements 98 | print ("Got %d items for user %s"%(len(recent_media), media.user)) 99 | # print user full name, id, bio, number of followers 100 | print ("This is %s, ID %s, bio %s, followed by %s"%(user_info.full_name, 101 | user_info.id, 102 | user_info.bio, 103 | user_info.counts['followed_by'])) 104 | print ("++") 105 | 106 | # search public content posted around a geo-location (cornell tech) 107 | crawled_media = api.media_search(___3=40.741, ___3=-74.002) 108 | print "Got %d results\n" % len(crawled_media) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Introduction to Connective Media 2 | 3 | INFO 5302
4 | Spring 2015
5 | Prof. Mor Naaman
6 | Touchdown (3rd floor, Cornell Tech)
7 | Thursdays, noon-2:45pm 8 | 9 | \#introCM 10 | 11 | #### [Week-by-week deliverables and requirements](https://github.com/cornelltech/intro-to-connective-media/wiki/Schedule-for-Deliverables) 12 | 13 | ## What is this Course? 14 | Connective Media is the set of technologies that are bringing together communication, information, and media, thus transforming the way we interact with the world, with technology, and with each other. Connective Media services are changing the way in which we behave as a society: the way we act, the way we get information, the way we diffuse information, the way we shape our views and our culture. To innovate and excel in these areas, students need technical skills and knowledge as well as understanding of the behavioral and social sciences, business, ethics, and design. 15 | 16 | This course will cover the socio-technical, design and product background that is paramount to operating in the connective media landscape. 17 | 18 | ## Class Objectives 19 | 20 | This course, the core course in the Connective Media Systems Technologies track, explores different types of connective media systems and technologies. The course provides an overview of core Connective Media systems, with an eye towards understanding the theory, design and product decisions that support those platforms. In addition, the course provides an understanding of key operational aspects of Connective Media environments, such as measurement and monetization. Finally, the course introduces students to key technologies that are used in Connective Media systems. The course core components will address different types of Connective Media systems, from 1-1 communication tools to large-scale media, using multiple disciplinary perspectives to analyze these platforms. 21 | 22 | At the completion of the course, students will become familiar with the various factors that are in play in designing and building Connective Media services in various contexts; recognize key factors in conducting academic research on Connective Media services; understand important features of Connective Media, design and prototype new Connective Media applications, analyze Connective Media datasets, and understand the research issues in this field. 23 | 24 | ## Week-by-week 25 | 26 | This is the week-by-week plan: 27 | 28 | | Week/Date | Title | Deep Dive | Special Topic / Tech Dive | Services | 29 | |:----------|:------|:----------|:--------------|:----------| 30 | |1
1/22|Intro to Everything [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%201%20overview%20and%20oauth.pdf?api=v2)||O-Auth || 31 | |2
1/29|1-1 Communication Systems [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%202%201-1%20communications.pdf?api=v2)|Presence; Network Effects| Messaging Protocols

|Skype, Snapchat, Facebook Messenger, Words with Friends| 32 | |3
2/5|Groupware [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%203%20groups.pdf?api=v2)|||Slack, What'sApp, Hipchat, Trello| 33 | |4
2/12|Communities and Forums [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%204%20communities.pdf?api=v2)||Community Design|[Patients Like Me](http://www.patientslikeme.com/), [Facebook Rooms](http://www.rooms.me/), [Mac Rumors forums](http://forums.macrumors.com/), [Reddit Books](http://www.reddit.com/r/books/) | 34 | |5
2/19|Social Awareness Streams [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%205%20SAS.pdf?api=v2)|Identity and Reputation|Social APIs |Twitter, Facebook, Pinterest, LinkedIn, Tumblr| 35 | |6
2/26|(Social) News [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%206%20social%20news%20short.pdf?api=v2)||Content Strategy
Special guests: Michael Young (CTO) and Justin Van Slembrouck (Design Director), Digg |[Reddit](http://reddit.com), [BuzzFeed](http://buzzfeed.com), [Digg](http://digg.com), [NY Times](http://nytimes.com), [Medium](http://medium.com), [Circa](http://cir.ca/)| 36 | |7
3/5|Anonymous Networks [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%207%20anoymous.pdf?api=v2)|Anonymity|Special guest: YikYak co-founder Brooks Buffington, live from Georgia Tech!|Secret, YikYak, 4chan| 37 | |8
3/12|Collaborative Platforms [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%208%20wikipedia%20and%20others.pdf?api=v2)|Social roles and contributions| Measurement and metrics. Special guest: [Glen Kushner](https://www.linkedin.com/in/glenkushner) |Wikipedia, Github, Stack Exchange, Scratch| 38 | |9
3/19|Crowdsourcing Systems [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%209%20crowdsourcing.pdf?api=v2)|Amazon Mechanical Turk|Data Analysis in iPython |TaskRabbit, Amazon Mechanical Turk, oDesk, Zooniverse.org| 39 | |10
3/26|Photo/Video Sharing [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%2010%20photo%20video%20sharing.pdf?api=v2)|Feedback|IP, Copyright and Content Rights
Special guest: Ayman Shamma of Yahoo! Labs and Flickr|Instagram, Flickr, 500px, YouTube, Vimeo| 40 | |11
4/9|Broadcast and Entertainment [(slides)](https://confluence.cornell.edu/download/attachments/302745741/class%2011%20entertainment%20rec%20systems%20distribution.pdf?api=v2)|Recommender Systems|Distribution|Netflix, Hulu, AOL On, Yahoo Screen| 41 | |12
4/16|Online/offline and Neighborhood Tech| | |NextDoor, [Ingress](http://ingress.com), iNeighbors, Swarm| 42 | |13
4/23|Sharing Economy\*|Privacy| Special guest: Helen Nissenbaum (NYU) | Lyft, AirBnB, [Puddle](https://www.puddle.com/), [NeighborGoods](http://neighborgoods.net/) | 43 | |14
4/30|Project Presentations| | Monetization | | 44 | 45 | \* subject to change based on class input 46 | ## Class Requirements 47 | 48 | ### Readings 49 | 50 | The reading materials, mostly papers from the field of social computing, are listed below in the week-to-week schedule. All the readings are required, and you will be asked submit an online response to the reading every week before class. You may be asked, for example, to reason about each reading, provide critique and extensions, and comment about its significance in the context of connective media technology. Grades are assigned per reading. Your lowest two reading reflection grades will not be counted; these two lowest grades may include submissions that you missed (no questions asked). Late submissions will be treated as missing. 51 | 52 | ### Services 53 | 54 | Each week (see schedule below) you will be asked to sign up, use, and analyze a small set of services that correspond to the week’s topic. You will be asked to submit an online response every week to a question about these services. Grades are assigned per week. Your lowest two grades will not be counted; these two lowest grades may include submissions that you missed (no questions asked). Late submissions will be treated as missing. 55 | 56 | ### Assignments 57 | 58 | There are three technical assignments (group projects) to be submitted throughout the semester: a social data explorer; connective media design; and data analysis. The details of the assignments are provided separately. 59 | 60 | ### Presentation 61 | Each student will participate in one group class presentation about a specific set of Connective Media technologies. Each presentation will summarize the key theoretical, design and product differences between the systems and services in a specific group of technologies. Exact instructions and guidelines [are below](#presreq). 62 | 63 | ### Attendance 64 | 65 | You may miss up to one class without notice, but no more than two absences are acceptable, even with excuse. In any case, please do let me know if you happen to miss a class session, either in advance or retroactively. 66 | 67 | ### Participation 68 | 69 | Class participation is part of the grade, and is function of the quantity and quality of your class discussion. Not being able to discuss the readings in class will cost you participation points. 70 | 71 | ### Exams 72 | 73 | There are no exams. 74 | 75 | ## Grades 76 | 77 | Your grade breakdown (G for Group grade): 78 | 15% Class presentation (G) 79 | 15% Reading and service responses 80 | 10% Participation 81 | 10% Social Explorer assignment (G) 82 | 30% Design assignment (G) 83 | 20% Data Analysis assignment (G) 84 | 85 | Note: the average grade in this class is likely to be a B or B+. You will need to really stand out to get an A. 86 | 87 | M.Eng and MBA students may take the class for a pass-fail grade with prior approval. All the requirements for class would still stand. To get a passing grade, a student would need a C and above grade for each of the class components. 88 | 89 | ## Key Threads 90 | 91 | - **Design** - key elements in CM product design. 92 | - **Product/Biz** - Key product aspects that drive the CM business. 93 | - **Technology** - Key technologies that are used in CM systems. 94 | - **Theory** - Key ideas from social computing that are relevant to CM. 95 | 96 | 97 | ## Class Presentations 98 | 99 | 100 | ### Requirements and procedures 101 | 102 | Class presentations will be assigned by the instructor, based on student preferences. 103 | 104 | The basic presentations should be 15 minutes long, strictly enforced, but the presenters should lead an additional 10-15 minutes of discussion. The initial presentation should briefly touch on: 105 | - The main design decisions made by the different applications/services 106 | - How these decisions impact the service in different ways, including: types of usage, nature of content, retention, patterns of consumption etc. 107 | 108 | The presenters will use examples and screenshots from the services they compare, and for extra credit, identify and discuss additional scholarly articles that are related to the service types. These articles could be a) describing a related theory, or b) studying and providing insights about the services or other related platforms and systems. I will be available to provide some pointers and directions as needed; you will need to approach me by Sunday before your presentation, at the latest, to get help. 109 | 110 | The presentation and discussion after may also refer to past/future trends for this category. What's next for these types of services? Bonus points for original ways to lead or encourage discussion and participation! 111 | 112 | Your presentation grade will be based on the quality and clarity of your presentation and the discussion. 113 | 114 | ## The teaching team 115 | 116 | ### Mor Naaman 117 | Instructor, Associate Professor, and Ice Breaker
118 | mor -AT- jacobs.cornell.edu
119 | @informor 120 | 121 | Where to find him: anywhere on campus
122 | When to find him: email to schedule time to chat 123 | 124 | ### Nir Grinberg 125 | Teaching Assistant, PhD Student, and Fire Starter
126 | nir -AT- cs.cornell.edu
127 | @grinbergnir 128 | 129 | Where to find him: hiding behind Mor
130 | When to find him: email to schedule time to chat
131 | -------------------------------------------------------------------------------- /Last.Fm Artist Recommeder.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "name": "", 4 | "signature": "sha256:69ed8196c0e4f93bf3ad221ba65d6f6c545f9f03b31b7293fe055ca497d11310" 5 | }, 6 | "nbformat": 3, 7 | "nbformat_minor": 0, 8 | "worksheets": [ 9 | { 10 | "cells": [ 11 | { 12 | "cell_type": "markdown", 13 | "metadata": {}, 14 | "source": [ 15 | "#Last.fm Artist Recommendation \n", 16 | "\n", 17 | "###Adapted from: Kartik Jagdale (https://github.com/kartikjagdale)\n", 18 | "`Last.fm is a music discovery service that gives you personalised recommendations based on the music you listen to.`\n", 19 | "\n", 20 | "Here we are going to do some machine learning and data analysis on the dataset from last.fm in order to recommend artists to the user.\n", 21 | "\n", 22 | "We are going to use `Nearest Neighbors Algorithm` to predict the next artists that a user would like to hear.\n", 23 | "\n", 24 | "**Note**: Dataset retrieved Last.fm *[LastFM_Matrix.csv]* contaning `1257 users and 285 artists`. \n", 25 | "\n" 26 | ] 27 | }, 28 | { 29 | "cell_type": "code", 30 | "collapsed": false, 31 | "input": [ 32 | "# First Import some essential Libraries\n", 33 | "import os\n", 34 | "import pandas as pd\n", 35 | "import numpy as np\n", 36 | "from sklearn.metrics.pairwise import cosine_similarity # For calculating similarity matrix\n", 37 | "from sklearn.neighbors import NearestNeighbors" 38 | ], 39 | "language": "python", 40 | "metadata": {}, 41 | "outputs": [], 42 | "prompt_number": 1 43 | }, 44 | { 45 | "cell_type": "code", 46 | "collapsed": false, 47 | "input": [ 48 | "from IPython.display import Image\n", 49 | "Image(url='http://python.org/images/python-logo.gif')" 50 | ], 51 | "language": "python", 52 | "metadata": {}, 53 | "outputs": [ 54 | { 55 | "html": [ 56 | "" 57 | ], 58 | "metadata": {}, 59 | "output_type": "pyout", 60 | "prompt_number": 12, 61 | "text": [ 62 | "" 63 | ] 64 | } 65 | ], 66 | "prompt_number": 12 67 | }, 68 | { 69 | "cell_type": "code", 70 | "collapsed": false, 71 | "input": [ 72 | "DIR_PATH = os.getcwd() #Get currect directory\n", 73 | "\n", 74 | "lfm = pd.read_csv(DIR_PATH + os.sep + \"LastFM_Matrix.csv\") #Load dataset\n", 75 | "lfm.head() #Display Head of the dataset" 76 | ], 77 | "language": "python", 78 | "metadata": {}, 79 | "outputs": [ 80 | { 81 | "html": [ 82 | "
\n", 83 | "\n", 84 | " \n", 85 | " \n", 86 | " \n", 87 | " \n", 88 | " \n", 89 | " \n", 90 | " \n", 91 | " \n", 92 | " \n", 93 | " \n", 94 | " \n", 95 | " \n", 96 | " \n", 97 | " \n", 98 | " \n", 99 | " \n", 100 | " \n", 101 | " \n", 102 | " \n", 103 | " \n", 104 | " \n", 105 | " \n", 106 | " \n", 107 | " \n", 108 | " \n", 109 | " \n", 110 | " \n", 111 | " \n", 112 | " \n", 113 | " \n", 114 | " \n", 115 | " \n", 116 | " \n", 117 | " \n", 118 | " \n", 119 | " \n", 120 | " \n", 121 | " \n", 122 | " \n", 123 | " \n", 124 | " \n", 125 | " \n", 126 | " \n", 127 | " \n", 128 | " \n", 129 | " \n", 130 | " \n", 131 | " \n", 132 | " \n", 133 | " \n", 134 | " \n", 135 | " \n", 136 | " \n", 137 | " \n", 138 | " \n", 139 | " \n", 140 | " \n", 141 | " \n", 142 | " \n", 143 | " \n", 144 | " \n", 145 | " \n", 146 | " \n", 147 | " \n", 148 | " \n", 149 | " \n", 150 | " \n", 151 | " \n", 152 | " \n", 153 | " \n", 154 | " \n", 155 | " \n", 156 | " \n", 157 | " \n", 158 | " \n", 159 | " \n", 160 | " \n", 161 | " \n", 162 | " \n", 163 | " \n", 164 | " \n", 165 | " \n", 166 | " \n", 167 | " \n", 168 | " \n", 169 | " \n", 170 | " \n", 171 | " \n", 172 | " \n", 173 | " \n", 174 | " \n", 175 | " \n", 176 | " \n", 177 | " \n", 178 | " \n", 179 | " \n", 180 | " \n", 181 | " \n", 182 | " \n", 183 | " \n", 184 | " \n", 185 | " \n", 186 | " \n", 187 | " \n", 188 | " \n", 189 | " \n", 190 | " \n", 191 | " \n", 192 | " \n", 193 | " \n", 194 | " \n", 195 | " \n", 196 | " \n", 197 | " \n", 198 | " \n", 199 | " \n", 200 | " \n", 201 | " \n", 202 | " \n", 203 | " \n", 204 | " \n", 205 | " \n", 206 | " \n", 207 | " \n", 208 | " \n", 209 | " \n", 210 | " \n", 211 | " \n", 212 | " \n", 213 | " \n", 214 | " \n", 215 | " \n", 216 | " \n", 217 | " \n", 218 | " \n", 219 | " \n", 220 | " \n", 221 | " \n", 222 | " \n", 223 | " \n", 224 | " \n", 225 | " \n", 226 | " \n", 227 | " \n", 228 | " \n", 229 | " \n", 230 | " \n", 231 | " \n", 232 | "
usera perfect circleabbaac/dcadam greenaerosmithafiairalanis morissettealexisonfire...timbalandtom waitstooltori amostravistriviumu2underoathvolbeatyann tiersen
0 1 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
1 33 0 0 0 1 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
2 42 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
3 51 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
4 62 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
\n", 233 | "

5 rows \u00d7 286 columns

\n", 234 | "
" 235 | ], 236 | "metadata": {}, 237 | "output_type": "pyout", 238 | "prompt_number": 2, 239 | "text": [ 240 | " user a perfect circle abba ac/dc adam green aerosmith afi air \\\n", 241 | "0 1 0 0 0 0 0 0 0 \n", 242 | "1 33 0 0 0 1 0 0 0 \n", 243 | "2 42 0 0 0 0 0 0 0 \n", 244 | "3 51 0 0 0 0 0 0 0 \n", 245 | "4 62 0 0 0 0 0 0 0 \n", 246 | "\n", 247 | " alanis morissette alexisonfire ... timbaland tom waits tool \\\n", 248 | "0 0 0 ... 0 0 0 \n", 249 | "1 0 0 ... 0 0 0 \n", 250 | "2 0 0 ... 0 0 0 \n", 251 | "3 0 0 ... 0 0 0 \n", 252 | "4 0 0 ... 0 0 0 \n", 253 | "\n", 254 | " tori amos travis trivium u2 underoath volbeat yann tiersen \n", 255 | "0 0 0 0 0 0 0 0 \n", 256 | "1 0 0 0 0 0 0 0 \n", 257 | "2 0 0 0 0 0 0 0 \n", 258 | "3 0 0 0 0 0 0 0 \n", 259 | "4 0 0 0 0 0 0 0 \n", 260 | "\n", 261 | "[5 rows x 286 columns]" 262 | ] 263 | } 264 | ], 265 | "prompt_number": 2 266 | }, 267 | { 268 | "cell_type": "code", 269 | "collapsed": false, 270 | "input": [ 271 | "from IPython.display import YouTubeVideo\n", 272 | "YouTubeVideo('xFrGuyw1V8s')" 273 | ], 274 | "language": "python", 275 | "metadata": {}, 276 | "outputs": [ 277 | { 278 | "html": [ 279 | "\n", 280 | " \n", 287 | " " 288 | ], 289 | "metadata": {}, 290 | "output_type": "pyout", 291 | "prompt_number": 13, 292 | "text": [ 293 | "" 294 | ] 295 | } 296 | ], 297 | "prompt_number": 13 298 | }, 299 | { 300 | "cell_type": "markdown", 301 | "metadata": {}, 302 | "source": [ 303 | "lets get all/some names of artists and user coloumn in the dataset" 304 | ] 305 | }, 306 | { 307 | "cell_type": "code", 308 | "collapsed": false, 309 | "input": [ 310 | "artists = pd.DataFrame(lfm.columns)\n", 311 | "artists.head(10)" 312 | ], 313 | "language": "python", 314 | "metadata": {}, 315 | "outputs": [ 316 | { 317 | "html": [ 318 | "
\n", 319 | "\n", 320 | " \n", 321 | " \n", 322 | " \n", 323 | " \n", 324 | " \n", 325 | " \n", 326 | " \n", 327 | " \n", 328 | " \n", 329 | " \n", 330 | " \n", 331 | " \n", 332 | " \n", 333 | " \n", 334 | " \n", 335 | " \n", 336 | " \n", 337 | " \n", 338 | " \n", 339 | " \n", 340 | " \n", 341 | " \n", 342 | " \n", 343 | " \n", 344 | " \n", 345 | " \n", 346 | " \n", 347 | " \n", 348 | " \n", 349 | " \n", 350 | " \n", 351 | " \n", 352 | " \n", 353 | " \n", 354 | " \n", 355 | " \n", 356 | " \n", 357 | " \n", 358 | " \n", 359 | " \n", 360 | " \n", 361 | " \n", 362 | " \n", 363 | " \n", 364 | " \n", 365 | " \n", 366 | " \n", 367 | " \n", 368 | "
0
0 user
1 a perfect circle
2 abba
3 ac/dc
4 adam green
5 aerosmith
6 afi
7 air
8 alanis morissette
9 alexisonfire
\n", 369 | "
" 370 | ], 371 | "metadata": {}, 372 | "output_type": "pyout", 373 | "prompt_number": 3, 374 | "text": [ 375 | " 0\n", 376 | "0 user\n", 377 | "1 a perfect circle\n", 378 | "2 abba\n", 379 | "3 ac/dc\n", 380 | "4 adam green\n", 381 | "5 aerosmith\n", 382 | "6 afi\n", 383 | "7 air\n", 384 | "8 alanis morissette\n", 385 | "9 alexisonfire" 386 | ] 387 | } 388 | ], 389 | "prompt_number": 3 390 | }, 391 | { 392 | "cell_type": "markdown", 393 | "metadata": {}, 394 | "source": [ 395 | "Now let's import only artists and make a new DataFrame" 396 | ] 397 | }, 398 | { 399 | "cell_type": "code", 400 | "collapsed": false, 401 | "input": [ 402 | "lfm_artists = lfm.drop(\"user\",axis =1) #drop user column\n", 403 | "lfm_artists.head() # Show Head" 404 | ], 405 | "language": "python", 406 | "metadata": {}, 407 | "outputs": [ 408 | { 409 | "html": [ 410 | "
\n", 411 | "\n", 412 | " \n", 413 | " \n", 414 | " \n", 415 | " \n", 416 | " \n", 417 | " \n", 418 | " \n", 419 | " \n", 420 | " \n", 421 | " \n", 422 | " \n", 423 | " \n", 424 | " \n", 425 | " \n", 426 | " \n", 427 | " \n", 428 | " \n", 429 | " \n", 430 | " \n", 431 | " \n", 432 | " \n", 433 | " \n", 434 | " \n", 435 | " \n", 436 | " \n", 437 | " \n", 438 | " \n", 439 | " \n", 440 | " \n", 441 | " \n", 442 | " \n", 443 | " \n", 444 | " \n", 445 | " \n", 446 | " \n", 447 | " \n", 448 | " \n", 449 | " \n", 450 | " \n", 451 | " \n", 452 | " \n", 453 | " \n", 454 | " \n", 455 | " \n", 456 | " \n", 457 | " \n", 458 | " \n", 459 | " \n", 460 | " \n", 461 | " \n", 462 | " \n", 463 | " \n", 464 | " \n", 465 | " \n", 466 | " \n", 467 | " \n", 468 | " \n", 469 | " \n", 470 | " \n", 471 | " \n", 472 | " \n", 473 | " \n", 474 | " \n", 475 | " \n", 476 | " \n", 477 | " \n", 478 | " \n", 479 | " \n", 480 | " \n", 481 | " \n", 482 | " \n", 483 | " \n", 484 | " \n", 485 | " \n", 486 | " \n", 487 | " \n", 488 | " \n", 489 | " \n", 490 | " \n", 491 | " \n", 492 | " \n", 493 | " \n", 494 | " \n", 495 | " \n", 496 | " \n", 497 | " \n", 498 | " \n", 499 | " \n", 500 | " \n", 501 | " \n", 502 | " \n", 503 | " \n", 504 | " \n", 505 | " \n", 506 | " \n", 507 | " \n", 508 | " \n", 509 | " \n", 510 | " \n", 511 | " \n", 512 | " \n", 513 | " \n", 514 | " \n", 515 | " \n", 516 | " \n", 517 | " \n", 518 | " \n", 519 | " \n", 520 | " \n", 521 | " \n", 522 | " \n", 523 | " \n", 524 | " \n", 525 | " \n", 526 | " \n", 527 | " \n", 528 | " \n", 529 | " \n", 530 | " \n", 531 | " \n", 532 | " \n", 533 | " \n", 534 | " \n", 535 | " \n", 536 | " \n", 537 | " \n", 538 | " \n", 539 | " \n", 540 | " \n", 541 | " \n", 542 | " \n", 543 | " \n", 544 | " \n", 545 | " \n", 546 | " \n", 547 | " \n", 548 | " \n", 549 | " \n", 550 | " \n", 551 | " \n", 552 | " \n", 553 | " \n", 554 | " \n", 555 | " \n", 556 | " \n", 557 | " \n", 558 | " \n", 559 | " \n", 560 | "
a perfect circleabbaac/dcadam greenaerosmithafiairalanis morissettealexisonfirealicia keys...timbalandtom waitstooltori amostravistriviumu2underoathvolbeatyann tiersen
0 0 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0
\n", 561 | "

5 rows \u00d7 285 columns

\n", 562 | "
" 563 | ], 564 | "metadata": {}, 565 | "output_type": "pyout", 566 | "prompt_number": 4, 567 | "text": [ 568 | " a perfect circle abba ac/dc adam green aerosmith afi air \\\n", 569 | "0 0 0 0 0 0 0 0 \n", 570 | "1 0 0 0 1 0 0 0 \n", 571 | "2 0 0 0 0 0 0 0 \n", 572 | "3 0 0 0 0 0 0 0 \n", 573 | "4 0 0 0 0 0 0 0 \n", 574 | "\n", 575 | " alanis morissette alexisonfire alicia keys ... timbaland \\\n", 576 | "0 0 0 0 ... 0 \n", 577 | "1 0 0 0 ... 0 \n", 578 | "2 0 0 0 ... 0 \n", 579 | "3 0 0 0 ... 0 \n", 580 | "4 0 0 0 ... 0 \n", 581 | "\n", 582 | " tom waits tool tori amos travis trivium u2 underoath volbeat \\\n", 583 | "0 0 0 0 0 0 0 0 0 \n", 584 | "1 0 0 0 0 0 0 0 0 \n", 585 | "2 0 0 0 0 0 0 0 0 \n", 586 | "3 0 0 0 0 0 0 0 0 \n", 587 | "4 0 0 0 0 0 0 0 0 \n", 588 | "\n", 589 | " yann tiersen \n", 590 | "0 0 \n", 591 | "1 0 \n", 592 | "2 0 \n", 593 | "3 0 \n", 594 | "4 0 \n", 595 | "\n", 596 | "[5 rows x 285 columns]" 597 | ] 598 | } 599 | ], 600 | "prompt_number": 4 601 | }, 602 | { 603 | "cell_type": "code", 604 | "collapsed": false, 605 | "input": [ 606 | "lfm_artists.shape #gives out total rows and columns" 607 | ], 608 | "language": "python", 609 | "metadata": {}, 610 | "outputs": [ 611 | { 612 | "metadata": {}, 613 | "output_type": "pyout", 614 | "prompt_number": 5, 615 | "text": [ 616 | "(1257, 285)" 617 | ] 618 | } 619 | ], 620 | "prompt_number": 5 621 | }, 622 | { 623 | "cell_type": "markdown", 624 | "metadata": {}, 625 | "source": [ 626 | "Calculate `cosine_similarity` in order to get Similarity Matrix" 627 | ] 628 | }, 629 | { 630 | "cell_type": "code", 631 | "collapsed": false, 632 | "input": [ 633 | "data_similarity = cosine_similarity(lfm_artists.T) #\n", 634 | "data_similarity" 635 | ], 636 | "language": "python", 637 | "metadata": {}, 638 | "outputs": [ 639 | { 640 | "metadata": {}, 641 | "output_type": "pyout", 642 | "prompt_number": 6, 643 | "text": [ 644 | "array([[ 1. , 0. , 0.01791723, ..., 0.06506 ,\n", 645 | " 0.05216405, 0. ],\n", 646 | " [ 0. , 1. , 0.05227877, ..., 0. ,\n", 647 | " 0.02536731, 0. ],\n", 648 | " [ 0.01791723, 0.05227877, 1. , ..., 0.02039967,\n", 649 | " 0.13084898, 0. ],\n", 650 | " ..., \n", 651 | " [ 0.06506 , 0. , 0.02039967, ..., 1. ,\n", 652 | " 0. , 0. ],\n", 653 | " [ 0.05216405, 0.02536731, 0.13084898, ..., 0. ,\n", 654 | " 1. , 0.02969569],\n", 655 | " [ 0. , 0. , 0. , ..., 0. ,\n", 656 | " 0.02969569, 1. ]])" 657 | ] 658 | } 659 | ], 660 | "prompt_number": 6 661 | }, 662 | { 663 | "cell_type": "markdown", 664 | "metadata": {}, 665 | "source": [ 666 | "Now we have obtained data similarity matrix now lets use K-nearest neighbour algo and predict the recommendations\n", 667 | "but first we will label the matrix " 668 | ] 669 | }, 670 | { 671 | "cell_type": "code", 672 | "collapsed": false, 673 | "input": [ 674 | "type(data_similarity)" 675 | ], 676 | "language": "python", 677 | "metadata": {}, 678 | "outputs": [ 679 | { 680 | "metadata": {}, 681 | "output_type": "pyout", 682 | "prompt_number": 7, 683 | "text": [ 684 | "numpy.ndarray" 685 | ] 686 | } 687 | ], 688 | "prompt_number": 7 689 | }, 690 | { 691 | "cell_type": "markdown", 692 | "metadata": {}, 693 | "source": [ 694 | "Lets convert it ito DataFrame" 695 | ] 696 | }, 697 | { 698 | "cell_type": "code", 699 | "collapsed": false, 700 | "input": [ 701 | "data_similarity_df = pd.DataFrame(data_similarity, columns=(lfm_artists.columns), index=(lfm_artists.columns))" 702 | ], 703 | "language": "python", 704 | "metadata": {}, 705 | "outputs": [], 706 | "prompt_number": 8 707 | }, 708 | { 709 | "cell_type": "code", 710 | "collapsed": false, 711 | "input": [ 712 | "data_similarity_df.head()# similarity Matrix" 713 | ], 714 | "language": "python", 715 | "metadata": {}, 716 | "outputs": [ 717 | { 718 | "html": [ 719 | "
\n", 720 | "\n", 721 | " \n", 722 | " \n", 723 | " \n", 724 | " \n", 725 | " \n", 726 | " \n", 727 | " \n", 728 | " \n", 729 | " \n", 730 | " \n", 731 | " \n", 732 | " \n", 733 | " \n", 734 | " \n", 735 | " \n", 736 | " \n", 737 | " \n", 738 | " \n", 739 | " \n", 740 | " \n", 741 | " \n", 742 | " \n", 743 | " \n", 744 | " \n", 745 | " \n", 746 | " \n", 747 | " \n", 748 | " \n", 749 | " \n", 750 | " \n", 751 | " \n", 752 | " \n", 753 | " \n", 754 | " \n", 755 | " \n", 756 | " \n", 757 | " \n", 758 | " \n", 759 | " \n", 760 | " \n", 761 | " \n", 762 | " \n", 763 | " \n", 764 | " \n", 765 | " \n", 766 | " \n", 767 | " \n", 768 | " \n", 769 | " \n", 770 | " \n", 771 | " \n", 772 | " \n", 773 | " \n", 774 | " \n", 775 | " \n", 776 | " \n", 777 | " \n", 778 | " \n", 779 | " \n", 780 | " \n", 781 | " \n", 782 | " \n", 783 | " \n", 784 | " \n", 785 | " \n", 786 | " \n", 787 | " \n", 788 | " \n", 789 | " \n", 790 | " \n", 791 | " \n", 792 | " \n", 793 | " \n", 794 | " \n", 795 | " \n", 796 | " \n", 797 | " \n", 798 | " \n", 799 | " \n", 800 | " \n", 801 | " \n", 802 | " \n", 803 | " \n", 804 | " \n", 805 | " \n", 806 | " \n", 807 | " \n", 808 | " \n", 809 | " \n", 810 | " \n", 811 | " \n", 812 | " \n", 813 | " \n", 814 | " \n", 815 | " \n", 816 | " \n", 817 | " \n", 818 | " \n", 819 | " \n", 820 | " \n", 821 | " \n", 822 | " \n", 823 | " \n", 824 | " \n", 825 | " \n", 826 | " \n", 827 | " \n", 828 | " \n", 829 | " \n", 830 | " \n", 831 | " \n", 832 | " \n", 833 | " \n", 834 | " \n", 835 | " \n", 836 | " \n", 837 | " \n", 838 | " \n", 839 | " \n", 840 | " \n", 841 | " \n", 842 | " \n", 843 | " \n", 844 | " \n", 845 | " \n", 846 | " \n", 847 | " \n", 848 | " \n", 849 | " \n", 850 | " \n", 851 | " \n", 852 | " \n", 853 | " \n", 854 | " \n", 855 | " \n", 856 | " \n", 857 | " \n", 858 | " \n", 859 | " \n", 860 | " \n", 861 | " \n", 862 | " \n", 863 | " \n", 864 | " \n", 865 | " \n", 866 | " \n", 867 | " \n", 868 | " \n", 869 | "
a perfect circleabbaac/dcadam greenaerosmithafiairalanis morissettealexisonfirealicia keys...timbalandtom waitstooltori amostravistriviumu2underoathvolbeatyann tiersen
a perfect circle 1.000000 0.000000 0.017917 0.051554 0.062776 0.000000 0.051755 0.060718 0 0.000000... 0.047338 0.081200 0.394709 0.125553 0.030359 0.111154 0.024398 0.06506 0.052164 0.000000
abba 0.000000 1.000000 0.052279 0.025071 0.061056 0.000000 0.016779 0.029527 0 0.000000... 0.000000 0.000000 0.000000 0.061056 0.029527 0.000000 0.094916 0.00000 0.025367 0.000000
ac/dc 0.017917 0.052279 1.000000 0.113154 0.177153 0.067894 0.075730 0.038076 0 0.088333... 0.044529 0.067894 0.058241 0.039367 0.000000 0.087131 0.122398 0.02040 0.130849 0.000000
adam green 0.051554 0.025071 0.113154 1.000000 0.056637 0.000000 0.093386 0.000000 0 0.025416... 0.000000 0.146516 0.083789 0.056637 0.082169 0.025071 0.022011 0.00000 0.023531 0.088045
aerosmith 0.062776 0.061056 0.177153 0.056637 1.000000 0.000000 0.113715 0.100056 0 0.061898... 0.052005 0.029735 0.025507 0.068966 0.033352 0.000000 0.214423 0.00000 0.057307 0.000000
\n", 870 | "

5 rows \u00d7 285 columns

\n", 871 | "
" 872 | ], 873 | "metadata": {}, 874 | "output_type": "pyout", 875 | "prompt_number": 9, 876 | "text": [ 877 | " a perfect circle abba ac/dc adam green aerosmith \\\n", 878 | "a perfect circle 1.000000 0.000000 0.017917 0.051554 0.062776 \n", 879 | "abba 0.000000 1.000000 0.052279 0.025071 0.061056 \n", 880 | "ac/dc 0.017917 0.052279 1.000000 0.113154 0.177153 \n", 881 | "adam green 0.051554 0.025071 0.113154 1.000000 0.056637 \n", 882 | "aerosmith 0.062776 0.061056 0.177153 0.056637 1.000000 \n", 883 | "\n", 884 | " afi air alanis morissette alexisonfire \\\n", 885 | "a perfect circle 0.000000 0.051755 0.060718 0 \n", 886 | "abba 0.000000 0.016779 0.029527 0 \n", 887 | "ac/dc 0.067894 0.075730 0.038076 0 \n", 888 | "adam green 0.000000 0.093386 0.000000 0 \n", 889 | "aerosmith 0.000000 0.113715 0.100056 0 \n", 890 | "\n", 891 | " alicia keys ... timbaland tom waits tool \\\n", 892 | "a perfect circle 0.000000 ... 0.047338 0.081200 0.394709 \n", 893 | "abba 0.000000 ... 0.000000 0.000000 0.000000 \n", 894 | "ac/dc 0.088333 ... 0.044529 0.067894 0.058241 \n", 895 | "adam green 0.025416 ... 0.000000 0.146516 0.083789 \n", 896 | "aerosmith 0.061898 ... 0.052005 0.029735 0.025507 \n", 897 | "\n", 898 | " tori amos travis trivium u2 underoath \\\n", 899 | "a perfect circle 0.125553 0.030359 0.111154 0.024398 0.06506 \n", 900 | "abba 0.061056 0.029527 0.000000 0.094916 0.00000 \n", 901 | "ac/dc 0.039367 0.000000 0.087131 0.122398 0.02040 \n", 902 | "adam green 0.056637 0.082169 0.025071 0.022011 0.00000 \n", 903 | "aerosmith 0.068966 0.033352 0.000000 0.214423 0.00000 \n", 904 | "\n", 905 | " volbeat yann tiersen \n", 906 | "a perfect circle 0.052164 0.000000 \n", 907 | "abba 0.025367 0.000000 \n", 908 | "ac/dc 0.130849 0.000000 \n", 909 | "adam green 0.023531 0.088045 \n", 910 | "aerosmith 0.057307 0.000000 \n", 911 | "\n", 912 | "[5 rows x 285 columns]" 913 | ] 914 | } 915 | ], 916 | "prompt_number": 9 917 | }, 918 | { 919 | "cell_type": "code", 920 | "collapsed": false, 921 | "input": [ 922 | "data_similarity_df.index.is_unique # check if there is no repeated artists" 923 | ], 924 | "language": "python", 925 | "metadata": {}, 926 | "outputs": [ 927 | { 928 | "metadata": {}, 929 | "output_type": "pyout", 930 | "prompt_number": 14, 931 | "text": [ 932 | "True" 933 | ] 934 | } 935 | ], 936 | "prompt_number": 14 937 | }, 938 | { 939 | "cell_type": "markdown", 940 | "metadata": {}, 941 | "source": [ 942 | "Now we will use `NearestNeighbors Algorithm` and apply to similarity matrix to get the recommendation" 943 | ] 944 | }, 945 | { 946 | "cell_type": "code", 947 | "collapsed": false, 948 | "input": [ 949 | "neigh = NearestNeighbors(n_neighbors=285)\n", 950 | "neigh.fit(data_similarity_df) # Fit the data" 951 | ], 952 | "language": "python", 953 | "metadata": {}, 954 | "outputs": [ 955 | { 956 | "metadata": {}, 957 | "output_type": "pyout", 958 | "prompt_number": 15, 959 | "text": [ 960 | "NearestNeighbors(algorithm='auto', leaf_size=30, metric='minkowski',\n", 961 | " metric_params=None, n_neighbors=285, p=2, radius=1.0)" 962 | ] 963 | } 964 | ], 965 | "prompt_number": 15 966 | }, 967 | { 968 | "cell_type": "code", 969 | "collapsed": false, 970 | "input": [ 971 | "#Copy the predicted data to a new DataFrame\n", 972 | "model = pd.DataFrame(neigh.kneighbors(data_similarity_df, return_distance=False))\n", 973 | "model.head() #gives you integer values instead of artist names" 974 | ], 975 | "language": "python", 976 | "metadata": {}, 977 | "outputs": [ 978 | { 979 | "html": [ 980 | "
\n", 981 | "\n", 982 | " \n", 983 | " \n", 984 | " \n", 985 | " \n", 986 | " \n", 987 | " \n", 988 | " \n", 989 | " \n", 990 | " \n", 991 | " \n", 992 | " \n", 993 | " \n", 994 | " \n", 995 | " \n", 996 | " \n", 997 | " \n", 998 | " \n", 999 | " \n", 1000 | " \n", 1001 | " \n", 1002 | " \n", 1003 | " \n", 1004 | " \n", 1005 | " \n", 1006 | " \n", 1007 | " \n", 1008 | " \n", 1009 | " \n", 1010 | " \n", 1011 | " \n", 1012 | " \n", 1013 | " \n", 1014 | " \n", 1015 | " \n", 1016 | " \n", 1017 | " \n", 1018 | " \n", 1019 | " \n", 1020 | " \n", 1021 | " \n", 1022 | " \n", 1023 | " \n", 1024 | " \n", 1025 | " \n", 1026 | " \n", 1027 | " \n", 1028 | " \n", 1029 | " \n", 1030 | " \n", 1031 | " \n", 1032 | " \n", 1033 | " \n", 1034 | " \n", 1035 | " \n", 1036 | " \n", 1037 | " \n", 1038 | " \n", 1039 | " \n", 1040 | " \n", 1041 | " \n", 1042 | " \n", 1043 | " \n", 1044 | " \n", 1045 | " \n", 1046 | " \n", 1047 | " \n", 1048 | " \n", 1049 | " \n", 1050 | " \n", 1051 | " \n", 1052 | " \n", 1053 | " \n", 1054 | " \n", 1055 | " \n", 1056 | " \n", 1057 | " \n", 1058 | " \n", 1059 | " \n", 1060 | " \n", 1061 | " \n", 1062 | " \n", 1063 | " \n", 1064 | " \n", 1065 | " \n", 1066 | " \n", 1067 | " \n", 1068 | " \n", 1069 | " \n", 1070 | " \n", 1071 | " \n", 1072 | " \n", 1073 | " \n", 1074 | " \n", 1075 | " \n", 1076 | " \n", 1077 | " \n", 1078 | " \n", 1079 | " \n", 1080 | " \n", 1081 | " \n", 1082 | " \n", 1083 | " \n", 1084 | " \n", 1085 | " \n", 1086 | " \n", 1087 | " \n", 1088 | " \n", 1089 | " \n", 1090 | " \n", 1091 | " \n", 1092 | " \n", 1093 | " \n", 1094 | " \n", 1095 | " \n", 1096 | " \n", 1097 | " \n", 1098 | " \n", 1099 | " \n", 1100 | " \n", 1101 | " \n", 1102 | " \n", 1103 | " \n", 1104 | " \n", 1105 | " \n", 1106 | " \n", 1107 | " \n", 1108 | " \n", 1109 | " \n", 1110 | " \n", 1111 | " \n", 1112 | " \n", 1113 | " \n", 1114 | " \n", 1115 | " \n", 1116 | " \n", 1117 | " \n", 1118 | " \n", 1119 | " \n", 1120 | " \n", 1121 | " \n", 1122 | " \n", 1123 | " \n", 1124 | " \n", 1125 | " \n", 1126 | " \n", 1127 | " \n", 1128 | " \n", 1129 | " \n", 1130 | "
0123456789...275276277278279280281282283284
0 0 277 81 70 189 206 108 235 264 80... 216 147 60 90 159 254 261 57 32 218
1 1 221 88 165 174 175 83 208 113 103... 230 33 213 172 19 79 162 150 125 241
2 2 128 172 36 190 75 182 116 258 140... 218 39 263 248 57 68 179 261 17 32
3 3 255 267 25 276 47 84 104 266 59... 213 11 90 20 238 79 92 162 150 125
4 4 281 157 158 115 93 106 78 103 262... 253 10 19 162 22 241 39 125 20 150
\n", 1131 | "

5 rows \u00d7 285 columns

\n", 1132 | "
" 1133 | ], 1134 | "metadata": {}, 1135 | "output_type": "pyout", 1136 | "prompt_number": 16, 1137 | "text": [ 1138 | " 0 1 2 3 4 5 6 7 8 9 ... 275 276 277 278 \\\n", 1139 | "0 0 277 81 70 189 206 108 235 264 80 ... 216 147 60 90 \n", 1140 | "1 1 221 88 165 174 175 83 208 113 103 ... 230 33 213 172 \n", 1141 | "2 2 128 172 36 190 75 182 116 258 140 ... 218 39 263 248 \n", 1142 | "3 3 255 267 25 276 47 84 104 266 59 ... 213 11 90 20 \n", 1143 | "4 4 281 157 158 115 93 106 78 103 262 ... 253 10 19 162 \n", 1144 | "\n", 1145 | " 279 280 281 282 283 284 \n", 1146 | "0 159 254 261 57 32 218 \n", 1147 | "1 19 79 162 150 125 241 \n", 1148 | "2 57 68 179 261 17 32 \n", 1149 | "3 238 79 92 162 150 125 \n", 1150 | "4 22 241 39 125 20 150 \n", 1151 | "\n", 1152 | "[5 rows x 285 columns]" 1153 | ] 1154 | } 1155 | ], 1156 | "prompt_number": 16 1157 | }, 1158 | { 1159 | "cell_type": "code", 1160 | "collapsed": false, 1161 | "input": [ 1162 | "final_model = pd.DataFrame(data_similarity_df.columns[model], index=data_similarity_df.index)#gives names with respect to artists\n" 1163 | ], 1164 | "language": "python", 1165 | "metadata": {}, 1166 | "outputs": [], 1167 | "prompt_number": 17 1168 | }, 1169 | { 1170 | "cell_type": "code", 1171 | "collapsed": false, 1172 | "input": [ 1173 | "final_model.head() #preview final Model" 1174 | ], 1175 | "language": "python", 1176 | "metadata": {}, 1177 | "outputs": [ 1178 | { 1179 | "html": [ 1180 | "
\n", 1181 | "\n", 1182 | " \n", 1183 | " \n", 1184 | " \n", 1185 | " \n", 1186 | " \n", 1187 | " \n", 1188 | " \n", 1189 | " \n", 1190 | " \n", 1191 | " \n", 1192 | " \n", 1193 | " \n", 1194 | " \n", 1195 | " \n", 1196 | " \n", 1197 | " \n", 1198 | " \n", 1199 | " \n", 1200 | " \n", 1201 | " \n", 1202 | " \n", 1203 | " \n", 1204 | " \n", 1205 | " \n", 1206 | " \n", 1207 | " \n", 1208 | " \n", 1209 | " \n", 1210 | " \n", 1211 | " \n", 1212 | " \n", 1213 | " \n", 1214 | " \n", 1215 | " \n", 1216 | " \n", 1217 | " \n", 1218 | " \n", 1219 | " \n", 1220 | " \n", 1221 | " \n", 1222 | " \n", 1223 | " \n", 1224 | " \n", 1225 | " \n", 1226 | " \n", 1227 | " \n", 1228 | " \n", 1229 | " \n", 1230 | " \n", 1231 | " \n", 1232 | " \n", 1233 | " \n", 1234 | " \n", 1235 | " \n", 1236 | " \n", 1237 | " \n", 1238 | " \n", 1239 | " \n", 1240 | " \n", 1241 | " \n", 1242 | " \n", 1243 | " \n", 1244 | " \n", 1245 | " \n", 1246 | " \n", 1247 | " \n", 1248 | " \n", 1249 | " \n", 1250 | " \n", 1251 | " \n", 1252 | " \n", 1253 | " \n", 1254 | " \n", 1255 | " \n", 1256 | " \n", 1257 | " \n", 1258 | " \n", 1259 | " \n", 1260 | " \n", 1261 | " \n", 1262 | " \n", 1263 | " \n", 1264 | " \n", 1265 | " \n", 1266 | " \n", 1267 | " \n", 1268 | " \n", 1269 | " \n", 1270 | " \n", 1271 | " \n", 1272 | " \n", 1273 | " \n", 1274 | " \n", 1275 | " \n", 1276 | " \n", 1277 | " \n", 1278 | " \n", 1279 | " \n", 1280 | " \n", 1281 | " \n", 1282 | " \n", 1283 | " \n", 1284 | " \n", 1285 | " \n", 1286 | " \n", 1287 | " \n", 1288 | " \n", 1289 | " \n", 1290 | " \n", 1291 | " \n", 1292 | " \n", 1293 | " \n", 1294 | " \n", 1295 | " \n", 1296 | " \n", 1297 | " \n", 1298 | " \n", 1299 | " \n", 1300 | " \n", 1301 | " \n", 1302 | " \n", 1303 | " \n", 1304 | " \n", 1305 | " \n", 1306 | " \n", 1307 | " \n", 1308 | " \n", 1309 | " \n", 1310 | " \n", 1311 | " \n", 1312 | " \n", 1313 | " \n", 1314 | " \n", 1315 | " \n", 1316 | " \n", 1317 | " \n", 1318 | " \n", 1319 | " \n", 1320 | " \n", 1321 | " \n", 1322 | " \n", 1323 | " \n", 1324 | " \n", 1325 | " \n", 1326 | " \n", 1327 | " \n", 1328 | " \n", 1329 | " \n", 1330 | "
0123456789...275276277278279280281282283284
a perfect circle a perfect circle tool dredg deftones nine inch nails porcupine tree godsmack staind the smashing pumpkins dream theater... red hot chili peppers katy perry coldplay ensiferum leona lewis the kooks the pussycat dolls christina aguilera beyonce rihanna
abba abba robbie williams elvis presley madonna michael jackson mika duffy queen groove coverage frank sinatra... slipknot billy talent rammstein metallica arctic monkeys disturbed linkin park killswitch engage in flames system of a down
ac/dc ac/dc iron maiden metallica black sabbath nirvana die toten hosen motorhead hammerfall the offspring judas priest... rihanna bloc party the shins the decemberists christina aguilera death cab for cutie modest mouse the pussycat dolls arcade fire beyonce
adam green adam green the libertines the strokes babyshambles tom waits bright eyes editors franz ferdinand the streets cocorosie... rammstein amon amarth ensiferum as i lay dying subway to sally disturbed equilibrium linkin park killswitch engage in flames
aerosmith aerosmith u2 led zeppelin lenny kravitz guns n roses eric clapton genesis dire straits frank sinatra the rolling stones... the killers all that remains arctic monkeys linkin park atreyu system of a down bloc party in flames as i lay dying killswitch engage
\n", 1331 | "

5 rows \u00d7 285 columns

\n", 1332 | "
" 1333 | ], 1334 | "metadata": {}, 1335 | "output_type": "pyout", 1336 | "prompt_number": 18, 1337 | "text": [ 1338 | " 0 1 2 \\\n", 1339 | "a perfect circle a perfect circle tool dredg \n", 1340 | "abba abba robbie williams elvis presley \n", 1341 | "ac/dc ac/dc iron maiden metallica \n", 1342 | "adam green adam green the libertines the strokes \n", 1343 | "aerosmith aerosmith u2 led zeppelin \n", 1344 | "\n", 1345 | " 3 4 5 6 \\\n", 1346 | "a perfect circle deftones nine inch nails porcupine tree godsmack \n", 1347 | "abba madonna michael jackson mika duffy \n", 1348 | "ac/dc black sabbath nirvana die toten hosen motorhead \n", 1349 | "adam green babyshambles tom waits bright eyes editors \n", 1350 | "aerosmith lenny kravitz guns n roses eric clapton genesis \n", 1351 | "\n", 1352 | " 7 8 9 \\\n", 1353 | "a perfect circle staind the smashing pumpkins dream theater \n", 1354 | "abba queen groove coverage frank sinatra \n", 1355 | "ac/dc hammerfall the offspring judas priest \n", 1356 | "adam green franz ferdinand the streets cocorosie \n", 1357 | "aerosmith dire straits frank sinatra the rolling stones \n", 1358 | "\n", 1359 | " ... 275 276 \\\n", 1360 | "a perfect circle ... red hot chili peppers katy perry \n", 1361 | "abba ... slipknot billy talent \n", 1362 | "ac/dc ... rihanna bloc party \n", 1363 | "adam green ... rammstein amon amarth \n", 1364 | "aerosmith ... the killers all that remains \n", 1365 | "\n", 1366 | " 277 278 279 \\\n", 1367 | "a perfect circle coldplay ensiferum leona lewis \n", 1368 | "abba rammstein metallica arctic monkeys \n", 1369 | "ac/dc the shins the decemberists christina aguilera \n", 1370 | "adam green ensiferum as i lay dying subway to sally \n", 1371 | "aerosmith arctic monkeys linkin park atreyu \n", 1372 | "\n", 1373 | " 280 281 282 \\\n", 1374 | "a perfect circle the kooks the pussycat dolls christina aguilera \n", 1375 | "abba disturbed linkin park killswitch engage \n", 1376 | "ac/dc death cab for cutie modest mouse the pussycat dolls \n", 1377 | "adam green disturbed equilibrium linkin park \n", 1378 | "aerosmith system of a down bloc party in flames \n", 1379 | "\n", 1380 | " 283 284 \n", 1381 | "a perfect circle beyonce rihanna \n", 1382 | "abba in flames system of a down \n", 1383 | "ac/dc arcade fire beyonce \n", 1384 | "adam green killswitch engage in flames \n", 1385 | "aerosmith as i lay dying killswitch engage \n", 1386 | "\n", 1387 | "[5 rows x 285 columns]" 1388 | ] 1389 | } 1390 | ], 1391 | "prompt_number": 18 1392 | }, 1393 | { 1394 | "cell_type": "code", 1395 | "collapsed": false, 1396 | "input": [ 1397 | "YouTubeVideo('BnO3nijfYmU')" 1398 | ], 1399 | "language": "python", 1400 | "metadata": {}, 1401 | "outputs": [ 1402 | { 1403 | "html": [ 1404 | "\n", 1405 | " \n", 1412 | " " 1413 | ], 1414 | "metadata": {}, 1415 | "output_type": "pyout", 1416 | "prompt_number": 25, 1417 | "text": [ 1418 | "" 1419 | ] 1420 | } 1421 | ], 1422 | "prompt_number": 25 1423 | }, 1424 | { 1425 | "cell_type": "markdown", 1426 | "metadata": {}, 1427 | "source": [ 1428 | "The above model gives us all 285 Recommendation, but we want only **Top 10 recommendation**, so lets modify the DataFrame a bit" 1429 | ] 1430 | }, 1431 | { 1432 | "cell_type": "code", 1433 | "collapsed": false, 1434 | "input": [ 1435 | "top10 = final_model[list(final_model.columns[:11])]" 1436 | ], 1437 | "language": "python", 1438 | "metadata": {}, 1439 | "outputs": [], 1440 | "prompt_number": 19 1441 | }, 1442 | { 1443 | "cell_type": "code", 1444 | "collapsed": false, 1445 | "input": [ 1446 | "top10.head()" 1447 | ], 1448 | "language": "python", 1449 | "metadata": {}, 1450 | "outputs": [ 1451 | { 1452 | "html": [ 1453 | "
\n", 1454 | "\n", 1455 | " \n", 1456 | " \n", 1457 | " \n", 1458 | " \n", 1459 | " \n", 1460 | " \n", 1461 | " \n", 1462 | " \n", 1463 | " \n", 1464 | " \n", 1465 | " \n", 1466 | " \n", 1467 | " \n", 1468 | " \n", 1469 | " \n", 1470 | " \n", 1471 | " \n", 1472 | " \n", 1473 | " \n", 1474 | " \n", 1475 | " \n", 1476 | " \n", 1477 | " \n", 1478 | " \n", 1479 | " \n", 1480 | " \n", 1481 | " \n", 1482 | " \n", 1483 | " \n", 1484 | " \n", 1485 | " \n", 1486 | " \n", 1487 | " \n", 1488 | " \n", 1489 | " \n", 1490 | " \n", 1491 | " \n", 1492 | " \n", 1493 | " \n", 1494 | " \n", 1495 | " \n", 1496 | " \n", 1497 | " \n", 1498 | " \n", 1499 | " \n", 1500 | " \n", 1501 | " \n", 1502 | " \n", 1503 | " \n", 1504 | " \n", 1505 | " \n", 1506 | " \n", 1507 | " \n", 1508 | " \n", 1509 | " \n", 1510 | " \n", 1511 | " \n", 1512 | " \n", 1513 | " \n", 1514 | " \n", 1515 | " \n", 1516 | " \n", 1517 | " \n", 1518 | " \n", 1519 | " \n", 1520 | " \n", 1521 | " \n", 1522 | " \n", 1523 | " \n", 1524 | " \n", 1525 | " \n", 1526 | " \n", 1527 | " \n", 1528 | " \n", 1529 | " \n", 1530 | " \n", 1531 | " \n", 1532 | " \n", 1533 | " \n", 1534 | " \n", 1535 | " \n", 1536 | " \n", 1537 | " \n", 1538 | " \n", 1539 | " \n", 1540 | " \n", 1541 | " \n", 1542 | " \n", 1543 | "
012345678910
a perfect circle a perfect circle tool dredg deftones nine inch nails porcupine tree godsmack staind the smashing pumpkins dream theater opeth
abba abba robbie williams elvis presley madonna michael jackson mika duffy queen groove coverage frank sinatra hans zimmer
ac/dc ac/dc iron maiden metallica black sabbath nirvana die toten hosen motorhead hammerfall the offspring judas priest bloodhound gang
adam green adam green the libertines the strokes babyshambles tom waits bright eyes editors franz ferdinand the streets cocorosie queens of the stone age
aerosmith aerosmith u2 led zeppelin lenny kravitz guns n roses eric clapton genesis dire straits frank sinatra the rolling stones deep purple
\n", 1544 | "
" 1545 | ], 1546 | "metadata": {}, 1547 | "output_type": "pyout", 1548 | "prompt_number": 20, 1549 | "text": [ 1550 | " 0 1 2 \\\n", 1551 | "a perfect circle a perfect circle tool dredg \n", 1552 | "abba abba robbie williams elvis presley \n", 1553 | "ac/dc ac/dc iron maiden metallica \n", 1554 | "adam green adam green the libertines the strokes \n", 1555 | "aerosmith aerosmith u2 led zeppelin \n", 1556 | "\n", 1557 | " 3 4 5 6 \\\n", 1558 | "a perfect circle deftones nine inch nails porcupine tree godsmack \n", 1559 | "abba madonna michael jackson mika duffy \n", 1560 | "ac/dc black sabbath nirvana die toten hosen motorhead \n", 1561 | "adam green babyshambles tom waits bright eyes editors \n", 1562 | "aerosmith lenny kravitz guns n roses eric clapton genesis \n", 1563 | "\n", 1564 | " 7 8 9 \\\n", 1565 | "a perfect circle staind the smashing pumpkins dream theater \n", 1566 | "abba queen groove coverage frank sinatra \n", 1567 | "ac/dc hammerfall the offspring judas priest \n", 1568 | "adam green franz ferdinand the streets cocorosie \n", 1569 | "aerosmith dire straits frank sinatra the rolling stones \n", 1570 | "\n", 1571 | " 10 \n", 1572 | "a perfect circle opeth \n", 1573 | "abba hans zimmer \n", 1574 | "ac/dc bloodhound gang \n", 1575 | "adam green queens of the stone age \n", 1576 | "aerosmith deep purple " 1577 | ] 1578 | } 1579 | ], 1580 | "prompt_number": 20 1581 | }, 1582 | { 1583 | "cell_type": "markdown", 1584 | "metadata": {}, 1585 | "source": [ 1586 | "Now lets put our results in `CSV` File called top10" 1587 | ] 1588 | }, 1589 | { 1590 | "cell_type": "code", 1591 | "collapsed": false, 1592 | "input": [ 1593 | "top10.to_csv(\"top10.csv\",index_label = \"Index\") # store data in csv file" 1594 | ], 1595 | "language": "python", 1596 | "metadata": {}, 1597 | "outputs": [], 1598 | "prompt_number": 21 1599 | }, 1600 | { 1601 | "cell_type": "markdown", 1602 | "metadata": {}, 1603 | "source": [ 1604 | "Now lets read the `CSV` File to check if its saved or not" 1605 | ] 1606 | }, 1607 | { 1608 | "cell_type": "code", 1609 | "collapsed": false, 1610 | "input": [ 1611 | "pd.read_csv(\"top10.csv\").head()" 1612 | ], 1613 | "language": "python", 1614 | "metadata": {}, 1615 | "outputs": [ 1616 | { 1617 | "html": [ 1618 | "
\n", 1619 | "\n", 1620 | " \n", 1621 | " \n", 1622 | " \n", 1623 | " \n", 1624 | " \n", 1625 | " \n", 1626 | " \n", 1627 | " \n", 1628 | " \n", 1629 | " \n", 1630 | " \n", 1631 | " \n", 1632 | " \n", 1633 | " \n", 1634 | " \n", 1635 | " \n", 1636 | " \n", 1637 | " \n", 1638 | " \n", 1639 | " \n", 1640 | " \n", 1641 | " \n", 1642 | " \n", 1643 | " \n", 1644 | " \n", 1645 | " \n", 1646 | " \n", 1647 | " \n", 1648 | " \n", 1649 | " \n", 1650 | " \n", 1651 | " \n", 1652 | " \n", 1653 | " \n", 1654 | " \n", 1655 | " \n", 1656 | " \n", 1657 | " \n", 1658 | " \n", 1659 | " \n", 1660 | " \n", 1661 | " \n", 1662 | " \n", 1663 | " \n", 1664 | " \n", 1665 | " \n", 1666 | " \n", 1667 | " \n", 1668 | " \n", 1669 | " \n", 1670 | " \n", 1671 | " \n", 1672 | " \n", 1673 | " \n", 1674 | " \n", 1675 | " \n", 1676 | " \n", 1677 | " \n", 1678 | " \n", 1679 | " \n", 1680 | " \n", 1681 | " \n", 1682 | " \n", 1683 | " \n", 1684 | " \n", 1685 | " \n", 1686 | " \n", 1687 | " \n", 1688 | " \n", 1689 | " \n", 1690 | " \n", 1691 | " \n", 1692 | " \n", 1693 | " \n", 1694 | " \n", 1695 | " \n", 1696 | " \n", 1697 | " \n", 1698 | " \n", 1699 | " \n", 1700 | " \n", 1701 | " \n", 1702 | " \n", 1703 | " \n", 1704 | " \n", 1705 | " \n", 1706 | " \n", 1707 | " \n", 1708 | " \n", 1709 | " \n", 1710 | " \n", 1711 | " \n", 1712 | " \n", 1713 | " \n", 1714 | "
Index012345678910
0 a perfect circle a perfect circle tool dredg deftones nine inch nails porcupine tree godsmack staind the smashing pumpkins dream theater opeth
1 abba abba robbie williams elvis presley madonna michael jackson mika duffy queen groove coverage frank sinatra hans zimmer
2 ac/dc ac/dc iron maiden metallica black sabbath nirvana die toten hosen motorhead hammerfall the offspring judas priest bloodhound gang
3 adam green adam green the libertines the strokes babyshambles tom waits bright eyes editors franz ferdinand the streets cocorosie queens of the stone age
4 aerosmith aerosmith u2 led zeppelin lenny kravitz guns n roses eric clapton genesis dire straits frank sinatra the rolling stones deep purple
\n", 1715 | "
" 1716 | ], 1717 | "metadata": {}, 1718 | "output_type": "pyout", 1719 | "prompt_number": 23, 1720 | "text": [ 1721 | " Index 0 1 2 \\\n", 1722 | "0 a perfect circle a perfect circle tool dredg \n", 1723 | "1 abba abba robbie williams elvis presley \n", 1724 | "2 ac/dc ac/dc iron maiden metallica \n", 1725 | "3 adam green adam green the libertines the strokes \n", 1726 | "4 aerosmith aerosmith u2 led zeppelin \n", 1727 | "\n", 1728 | " 3 4 5 6 \\\n", 1729 | "0 deftones nine inch nails porcupine tree godsmack \n", 1730 | "1 madonna michael jackson mika duffy \n", 1731 | "2 black sabbath nirvana die toten hosen motorhead \n", 1732 | "3 babyshambles tom waits bright eyes editors \n", 1733 | "4 lenny kravitz guns n roses eric clapton genesis \n", 1734 | "\n", 1735 | " 7 8 9 \\\n", 1736 | "0 staind the smashing pumpkins dream theater \n", 1737 | "1 queen groove coverage frank sinatra \n", 1738 | "2 hammerfall the offspring judas priest \n", 1739 | "3 franz ferdinand the streets cocorosie \n", 1740 | "4 dire straits frank sinatra the rolling stones \n", 1741 | "\n", 1742 | " 10 \n", 1743 | "0 opeth \n", 1744 | "1 hans zimmer \n", 1745 | "2 bloodhound gang \n", 1746 | "3 queens of the stone age \n", 1747 | "4 deep purple " 1748 | ] 1749 | } 1750 | ], 1751 | "prompt_number": 23 1752 | }, 1753 | { 1754 | "cell_type": "markdown", 1755 | "metadata": {}, 1756 | "source": [ 1757 | "##`Conclude`" 1758 | ] 1759 | }, 1760 | { 1761 | "cell_type": "markdown", 1762 | "metadata": {}, 1763 | "source": [ 1764 | "To conclude we have created a model which recommends next artist user will like to hear by using last.fm data.\n", 1765 | "\n", 1766 | "Further we can now use this model to make an `API` and use it in our Website or WebApp to recommend artists to the user.\n", 1767 | "\n", 1768 | "\n", 1769 | "** *Github Link* **: https://github.com/kartikjagdale/Last.fm-Song-Recommender" 1770 | ] 1771 | }, 1772 | { 1773 | "cell_type": "raw", 1774 | "metadata": {}, 1775 | "source": [ 1776 | "how to run ipython in command line:\n", 1777 | "ipython notebook --pylab=inline" 1778 | ] 1779 | } 1780 | ], 1781 | "metadata": {} 1782 | } 1783 | ] 1784 | } --------------------------------------------------------------------------------