{"id":115708,"date":"2022-12-08T09:42:46","date_gmt":"2022-12-08T09:42:46","guid":{"rendered":"https:\/\/nursingstudybay.com\/?p=115708"},"modified":"2022-12-08T09:42:49","modified_gmt":"2022-12-08T09:42:49","slug":"insy-5336-python-programming-assignment","status":"publish","type":"post","link":"https:\/\/www.studyproessays.com\/help\/insy-5336-python-programming-assignment\/","title":{"rendered":"INSY 5336 Python Programming Assignment"},"content":{"rendered":"<p>INSY 5336<br \/>\nPython Programming<br \/>\nAssignment<\/p>\n<p>The following guidelines should be followed and will be used to grade your homework:<br \/>\n\u2022\tAll code to be implemented and submitted as a jupyter notebook (.ipynb) file. Submit a single ipynb file.<br \/>\n\u2022\tThis is an individual homework assignment, no group submissions will be accepted. If you discuss in groups, please write your code individually and submit.<br \/>\n\u2022\tSample runs shown in the question should be used as a guide for implementation. However extensive testing needs to be done on your code to deal with all test cases that might possibly be executed.<br \/>\n\u2022\tThe logic of how you are solving the problem should be documented in the cell preceding the code in markdown language. In the case that your code is incorrect, your logic counts as effort points.<br \/>\n\u2022\tEvery code segment in the jupyter notebook cells should be well documented with comments. Use # in the code to provide comments and they should explain the algorithm step and what the code segment is doing. Follow the example in the notebook files provided in the lectures.<br \/>\n\u2022\tError checking in your code is very important and differentiates a high quality programmer from a low quality one. Use try\/except blocks, if statements and other python code constructs to deal with unexpected errors and deal with them gracefully. The homework will be graded for robustness of your code. You will lose 50% of the points if your code contains error\/does not run! You will lose 10% of the points if your code runs but produces wrong result. In the second situation, you will gain some points back if your logic is clear and correct. Error checking in your code is critical and distinguishes a high-quality programmer from a low-quality programmer. To handle unexpected errors gracefully, use try\/except blocks, if statements, and other python code constructs. The robustness of your code will be graded in the homework. If your code contains errors or does not run, you will lose 50% of your points! You will lose 10% of the points if your code runs but produces wrong result. In the second situation, you will gain some points back if your logic is clear and correct.<\/p>\n<p>(100 points) Write a python program that fetches movie information for the top 500 most popular movies from Metacritic. On this websites, there is an option to show the top movies called \u201cMovies of all times\u201d: https:\/\/www.metacritic.com\/browse\/movies\/score\/metascore\/all\/filtered?sort=desc<\/p>\n<p>You will first write python script that collect the movie information for the top 500 movies from the website. Next, from the movie information you have collected, extract 2 pieces of information: The name of the director(s), and the genre information of the movie (drama, action, thriller, etc). Build a dictionary of the movies that contain these information. Arrange them in any way you prefer but make sure we can access the information we need at any time. Store them in a comma separated file (called [your name]_movies.csv). (50 points)<\/p>\n<p>Your main program should ask users for three choices:<\/p>\n<p>1. The 1st option is \u2018movie\u2019, when user chooses this one, then your program should ask for the name of a movie (your program should be able to handle all upper and lower cases), your program should find the movie and display the director information and genre information. (10 points)<\/p>\n<p>2. The 2nd option is \u2018director\u2019, when user chooses this one, then your program should ask for the name of a director, then your program should find the person, and display: (a) all the movies that this person has directed, (b) a summary of the genres of the these movies (15 points)<\/p>\n<p>3. The 3rd option is \u2018comparison\u2019, when user choose this one, then your program should ask for the names of 2 directors, then calculate their cosine similarity based on the genre of movies they have directed (An example is given below on how to calculate cosine similarity).  (15 points)<\/p>\n<p>Lastly, writing task:<br \/>\nPick 3 of your favorite directors from this list of top 500 movies. Compare the career of these 5 directors (a vs b, b vs c, a vs c), do you see any similarity? Write a short report to summarize your finding (Times new roman, 12 font size, no more than 1 page).<br \/>\n(10 points, attention: Do not write a description of your code, do not write a description of the result, I want to see your personal observation here)<\/p>\n<p>Your submission will include 3 files.<br \/>\n1) The ipynb file with your python code.<br \/>\n2) Your .csv file that stores the reviews.<br \/>\n3) Your short report in word document.<\/p>\n<p>Example 1:<br \/>\nWhat do you want to check on Metacritic? (Please choose \u2018movie\u2019, \u2018director\u2019, or \u2018comparison\u2019)<br \/>\ninput: Movie<br \/>\nWhat movie do you want to check?<br \/>\ninput: savING private RYAN<\/p>\n<p>Output:<br \/>\nThe director of the movie is Steven Spielberg.<br \/>\nThe genre of the movie is action, war, drama.<\/p>\n<p>Example 2:<br \/>\nWhat do you want to check on IMDB? (Please choose \u2018movie\u2019, \u2018director\u2019, or \u2018comparison\u2019)<br \/>\ninput: director<br \/>\nWho do you want to check?<br \/>\ninput: Michael Bay<\/p>\n<p>Output:<br \/>\nMichael Bay has directed Transformer 1, Transformer 2, Transformer 3, Transformer 4\u2026\u2026 etc<br \/>\nHis most directed genres are drama: 22, war: 6, action: 10, crime: 4, thriller: 9.<\/p>\n<p>Example 3:<br \/>\nWhat do you want to check on IMDB? (Please choose \u2018movie\u2019, \u2018director\u2019, or \u2018comparison\u2019)<br \/>\ninput: COMparison<br \/>\nWho do you want to compare?<br \/>\ninput 1: Michael Bay<br \/>\ninput 2: Steven Spielberg<\/p>\n<p>Output:<br \/>\nMichael Bay has directed Transformer 1, Transformer 2, Transformer 3, Transformer 4\u2026\u2026 etc<br \/>\nHis most directed genres are drama: 22, war: 6, action: 10, crime: 4, thriller: 9.<\/p>\n<p>Steven Spielberg has directed Saving Private Ryan, Shindler\u2019s List\u2026.etc<br \/>\nHis most often played genres are drama 17, crime 20, action 31.<\/p>\n<p>Based on that, they have a cosine similarity score of 0.54.<\/p>\n<p>Hint 1: Organize your data in dictionaries with multiple layers.<br \/>\n{\u2018Saving Private Ryan\u2019:{( \u2018Steven Spielberg\u2019\u2026.): [\u2018action\u2019, \u2018war\u2019, \u2018drama\u2019\u2026.]}}<br \/>\nMovie name is the key on 1st level<br \/>\nThe director and genre form a sub-dictionary that is the value on 1st level.<br \/>\nThe director is the key on 2nd level (in the sub dictionary) (key cannot be mutable type, but some movies have multiple directors, so what do we do here?)<br \/>\nThe genre is the value on the 2nd level (in the sub dictionary)<\/p>\n<p>Hint 2: Some movies may be missing some information, your program will run into errors if you try to extract the same information for every movie. Think about how you deal with this.<\/p>\n<p>Example 2:<br \/>\nMichael Bay = Transformer: [action, sci-fi, drama], Batman:[ action,  drama]<\/p>\n<p>Steven Spielberg = Schindler&#8217;s List:[ drama, war], American Gangster:[ drama, crime, action]<\/p>\n<p>Michael Bay = {\u2018action\u2019: 2, \u2018drama\u2019: 2, \u2018sci-fi\u2019: 1}<br \/>\nSteven Spielberg = {\u2018drama\u2019: 2, \u2018war\u2019:1, \u2018crime\u2019:1, \u2018action\u2019 : 1}<\/p>\n<p>Common vector = (action, drama, sci-fi, war, crime)<br \/>\nMichael Bay = (2,2,1,0,0)<br \/>\nSteven Spielberg = (1,2,0,1,1)<\/p>\n<p>Then calculate the cosine similarity.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>INSY 5336 Python Programming Assignment The following guidelines should be followed and will be used to grade your homework: \u2022 All code to be implemented\u2026<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7853,8914],"tags":[9472],"class_list":["post-115708","post","type-post","status-publish","format-standard","hentry","category-computer-science-and-information-technology","category-computer-sciences-and-information-technology-essays","tag-insy-5336-python-programming-assignment"],"_links":{"self":[{"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/posts\/115708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/comments?post=115708"}],"version-history":[{"count":0,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/posts\/115708\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/media?parent=115708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/categories?post=115708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.studyproessays.com\/help\/wp-json\/wp\/v2\/tags?post=115708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}