Find the best tutors and institutes for Hadoop

Find Best Hadoop

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Outside India?

Search for topics

How do you build a movie recommendation system via SVD using Apache Spark?

Asked by Last Modified  

IT Courses/Hadoop

Follow 3
Answer

3 Answers

Please enter your answer

Big Data Architect

Some students got trained under me done this mini project. Please reach out, can guide you.
Comments

Trainer

Hi Deepak , You need to use machine learning algorithm for the recommendation system . you can select CollabFiltering Algorithm and SBT Algorithm for recommendation of the movie .
Comments

Getting and processing the data In order to build an on-line movie recommender using Spark, we need to have our model data as preprocessed as possible. Parsing the dataset and building the model everytime a new recommendation needs to be done is not the best of the strategies. The list of task... read more
Getting and processing the data In order to build an on-line movie recommender using Spark, we need to have our model data as preprocessed as possible. Parsing the dataset and building the model everytime a new recommendation needs to be done is not the best of the strategies. The list of task we can pre-compute includes: Loading and parsing the dataset. Persisting the resulting RDD for later use. Building the recommender model using the complete dataset. Persist the dataset for later use. This notebook explains the first of these tasks. complete_dataset_url = 'http://files.grouplens.org/datasets/movielens/ml-latest.zip' small_dataset_url = 'http://files.grouplens.org/datasets/movielens/ml-latest-small.zip' We also need to define download locations. import os datasets_path = os.path.join('..', 'datasets') complete_dataset_path = os.path.join(datasets_path, 'ml-latest.zip') small_dataset_path = os.path.join(datasets_path, 'ml-latest-small.zip') import urllib small_f = urllib.urlretrieve (small_dataset_url, small_dataset_path) complete_f = urllib.urlretrieve (complete_dataset_url, complete_dataset_path) Both of them are zip files containing a folder with ratings, movies, etc. We need to extract them into its individual folders so we can use each file later on. import zipfile with zipfile.ZipFile(small_dataset_path, "r") as z: z.extractall(datasets_path) with zipfile.ZipFile(complete_dataset_path, "r") as z: z.extractall(datasets_path) Loading and parsing datasets Now we are ready to read in each of the files and create an RDD consisting of parsed lines. Each line in the ratings dataset (ratings.csv) is formatted as: userId,movieId,rating,timestamp Each line in the movies (movies.csv) dataset is formatted as: movieId,title,genres Were genres has the format: Genre1|Genre2|Genre3... The tags file (tags.csv) has the format: userId,movieId,tag,timestamp And finally, the links.csv file has the format: movieId,imdbId,tmdbId The format of these files is uniform and simple, so we can use Python split() to parse their lines once they are loaded into RDDs. Parsing the movies and ratings files yields two RDDs: For each line in the ratings dataset, we create a tuple of (UserID, MovieID, Rating). We drop the timestamp because we do not need it for this recommender. For each line in the movies dataset, we create a tuple of (MovieID, Title). We drop the genres because we do not use them for this recommender. So let's load the raw ratings data. We need to filter out the header, included in each file. small_ratings_file = os.path.join(datasets_path, 'ml-latest-small', 'ratings.csv') small_ratings_raw_data = sc.textFile(small_ratings_file) small_ratings_raw_data_header = small_ratings_raw_data.take(1)[0] Now we can parse the raw data into a new RDD small_ratings_data = small_ratings_raw_data.filter(lambda line: line!=small_ratings_raw_data_header)\ .map(lambda line: line.split(",")).map(lambda tokens: (tokens[0],tokens[1],tokens[2])).cache() For illustrative purposes, we can take the first few lines of our RDD to see the result. In the final script we don't call any Spark action (e.g. take) until needed, since they trigger actual computations in the cluster. small_ratings_data.take(3) [(u'1', u'6', u'2.0'), (u'1', u'22', u'3.0'), (u'1', u'32', u'2.0')] We proceed in a similar way with the movies.csv file. small_movies_file = os.path.join(datasets_path, 'ml-latest-small', 'movies.csv') small_movies_raw_data = sc.textFile(small_movies_file) small_movies_raw_data_header = small_movies_raw_data.take(1)[0] small_movies_data = small_movies_raw_data.filter(lambda line: line!=small_movies_raw_data_header)\ .map(lambda line: line.split(",")).map(lambda tokens: (tokens[0],tokens[1])).cache() small_movies_data.take(3) [(u'1', u'Toy Story (1995)'), (u'2', u'Jumanji (1995)'), (u'3', u'Grumpier Old Men (1995)')] read less
Comments

View 1 more Answers

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Big Data & Hadoop - Introductory Session - Data Science for Everyone
Data Science for Everyone An introductory video lesson on Big Data, the need, necessity, evolution and contributing factors. This is presented by Skill Sigma as part of the "Data Science for Everyone" series.

Skill Sigma | 21/12/2018

0 0
0

Why is the Hadoop essential?
Capacity to store and process large measures of any information, rapidly. With information volumes and assortments always expanding, particularly from web-based life and the Internet of Things (IoT), that...

Use of Piggybank and Registration in Pig
What is a Piggybank? Piggybank is a jar and its a collection of user contributed UDF’s that is released along with Pig. These are not included in the Pig JAR, so we have to register them manually...

Sachin Patil | 16/09/2018

0 0
0

Recommended Articles

Big data is a phrase which is used to describe a very large amount of structured (or unstructured) data. This data is so big that it gets problematic to be handled using conventional database techniques and software. A Big Data Scientist is a business employee who is responsible for handling and statistically evaluating...

Read full article >

We have already discussed why and how Big Data is all set to revolutionize our lives, professions and the way we communicate. Data is growing by leaps and bounds. The Walmart database handles over 2.6 petabytes of massive data from several million customer transactions every hour. Facebook database, similarly handles...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system s storage capacity and you can t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Looking for Hadoop ?

Find best Hadoop in your locality on UrbanPro.

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you

Find Best Hadoop ?

Find Now »

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 25 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 6.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more