In assignment 1, you will complete three tasks. The goal of these tasks is to help you get familiar with Spark operations (e.g., transformations and actions) and MapReduce.2.1 Programming Requirements a. You must use Python to implement all tasks. You can only use standard python libraries (i.e., external libraries like numpy or pandas are not allowed). There will be 10% bonus for Scala implementation. You can get the bonus only when both Python and Scala implementations are correct. b. You are required to only use Spark RDD, i.e. no point if using Spark DataFrame or DataSet.2.2 Programming Environment Python 3.6, Scala 2.11, and Spark 2.3.0 We will use Vocareum to automatically run and grade your submission. We highly recommend that you first test your scripts on your machine and then submit to Vocareum if the testing is successful. You should have received an email from Vocareum to access the assignment 1. The email should contain some text like: “Welcome to Vocareum’s Coding Lab! You have been enrolled in the following course: Course: INF 553 – Spring 2020”. If you do not receive such an email, please contact your TA.2.3 Write your own code Do not share code with other students!! For this assignment to be an effective learning experience, you must write your own code! We emphasize this point because you will be able to find Python implementations of some of the required functions on the web. Please do not look for or at any such code! TAs will combine all the code we can find from the web (e.g., Github) as well as other students’ code from this and other (previous) sections for plagiarism detection. We will report all detected plagiarism to the university.In this assignment, you are provided with two datasets (i.e., reviews and businesses) extracted from the Yelp dataset for developing your assignment. 1 You can access and download the datasets either under the directory on Vocareum: resource/asnlib/publicdata/ or in the Google Drive: https://drive.google.com/drive/folders/1dnVCZazaR84UkvhHAwoHyFqxmFF01IHa?usp=sharing We generated these datasets in a random sampling way. These given datasets are only for your testing. During the grading period, we will use different sampled subsets of the Yelp datasets.4. Tasks You need to submit the following files on Vocareum: (all lowercase) A. Python scripts: task1.py, task2.py, task3.py B. [OPTIONAL] Scala scripts: task1.scala, task2.scala, task3.scala; Jar package: hw1.jar4.1 Task1: Data Exploration (3pts) 4.1.1 Task description You will explore the review dataset and write a program to answer the following questions: A. The total number of reviews (0.5pts) B. The number of reviews in a given year, y (0.5pts) C. The number of distinct users who have written the reviews (0.5pts) D. Top m users who have the largest number of reviews and its count (0.5pts) E. Top n frequent words in the review text. The words should be in lower cases. The following punctuations i.e., “(”, “[”, “,”, “.”, “!”, “?”, “:”, “;”, “]”, “)”, and the given stopwords are excluded (1pts)4.1.2 Execution commands Python: $ spark-submit task1.py Scala: $ spark-submit –class task1 hw1.jar Params: input_file – the input file (the review dataset) output_file – the output file contains your answers stopwords – the file contains the stopwords that should be removed for Question E y/m/n – see 4.1.1 4.1.3 Output format: You must write the results in the JSON format using exactly the same tags for each question (see an example in Figure 2). The answer for A/B/C is a number. The answer for D is a list of pairs [user, count]. The answer for E is a list of frequent words. All answers should be sorted by the count in the descending order. If two users/words have the same count, please sort them in the alphabetical order. 1 https://www.yelp.com/dataset Figure 2: An example output for task1 in JSON format 4.2 Task2: Exploration on Multiple Datasets (2pts)4.2.1 Task description In task2, you will explore the two datasets together (i.e., review and business) and write a program to compute the average stars for each business category and output top n categories with the highest average stars(1pts). The business categories should be extracted from the “categories” tag in the business file and split by comma (also need to remove leading and trailing spaces for the extracted categories). You need to implement a version without Spark and compare to a version with Spark for reducing the time duration of execution (1pts).4.2.2 Execution commands Python: $ spark-submit task2.py Scala: $ spark-submit –class task2 hw1.jar Params: review _file – the input file (the review dataset) business_file – the input file (the business dataset) output_file – the output file contains your answers if_spark – either “spark” or “no_spark” n – top n categories with highest average stars (see 4.2.1) 4.2.3 Output format: You must write the results in the JSON format using exactly the same tags (see an example in Figure 3). The answer is a list of pairs [category, stars], which are sorted by the stars in the descending order. If two categories have the same value, please sort the categories in the alphabetical order. Figure 3: An example output for task2 in JSON format4.3 Task3: Partition (3pts) 4.3.1 Task description In this task, you will learn how partitions work in the RDD. You need to compute the businesses that have more than n reviews in the review file (1pts). At the same time, you need to show the number of partitions for the RDD and the number of items per partition with either default or customized partition function (1pts). You should design a customized partition function to improve the computational efficiency, i.e., reducing the time duration of execution (1pts).4.3.2 Execution commands Python: $ spark-submit task3.py Scala: $ spark-submit –class task3 hw1.jar Params: input_file – the input file (the review dataset) output_file – the output file contains your answers partition_type – the partition function, either “default” or “customized” n_partitions – the number of partitions (only effective for the customized partition function) n – the threshold of the number of reviews (see 4.3.1) 4.3.3 Output format: You must write the results in the JSON format using exactly the same tags (see an example in Figure 4). The answer for the number of partitions is a number. The answer for the number of items per partition is a list of numbers. The answer for result is a list of pairs [business, count] (no need to sort). Figure 4: An example output for task3 in JSON format 5. About Vocareum 1. You can use the provided datasets under the directory resource: /asnlib/publicdata/ 2. You should upload the scripts under your workspace: work/ 3. Once you click on “Submit”, all the scripts are submitted and automatically run on Vocareum.4. We highly recommend that you first test your scripts on your machine and then submit to Vocareum if the testing is successful. 5. You can also test your Python/Scala implementations using the required execution commands in the Vocareum terminal before submitting. 6. Here are the testing commands for your reference: 7. You will receive a submission report after Vocareum finishes executing your scripts. The submission report should include the running time and score of each task for the Python implementation. We do not test the Scala implementation during the submission period.8. Vocareum will automatically run both Python and Scala implementations during the grading period. 9. Please start your assignment early! You can resubmit any script on Vocareum. We will grade on your last submission.6. Grading Criteria (% penalty = % penalty of possible points you get) 1. You can use your free 5-day extension separately or together. You must submit a late-day request via https://forms.gle/worKTbCRBWKQ6jqu6. This form is recording the number of late days you use for each assignment. By default, we will not count the late days if no request submitted.2. There will be 10% bonus for each task (i.e., 0.3pts, 0.2pts, and 0.3pts) if your Scala implementations are correct. Only when your Python results are correct, the bonus of using Scala will be calculated. There is no partial point for Scala. 3. There will be no point if your submission cannot be executed on Vocareum.4. There is no regrading. Once the grade is posted on the Blackboard, we will only regrade your assignments if there is a grading error. No exceptions. 5. There will be 20% penalty for the late submission within one week and no point after that.
Assignment, Complete, familiar, goal, help, INF553, operations, solved, Spark, Tasks, tasks., these, Three, will, with
[SOLVED] Inf553 assignment 1 in assignment 1, you will complete three tasks. the goal of these tasks is to help you get familiar with spark operations
$25
File Name: Inf553_assignment_1_in_assignment_1,_you_will_complete_three_tasks._the_goal_of_these_tasks_is_to_help_you_get_familiar_with_spark_operations.zip
File Size: 1328.22 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.