CS 1103 – Introductory Programming for Engineers and Scientists – Spring 2020 Project 2 This year the subject of your project will be The Movie DB (https://www.themoviedb.org/) which has data similar...

1 answer below »
Check files and download


CS 1103 – Introductory Programming for Engineers and Scientists – Spring 2020 Project 2 This year the subject of your project will be The Movie DB (https://www.themoviedb.org/) which has data similar to that of IMDB. From the class project webpage, you will need to download the database.mat file. This contains a subset of the movie database in the form of four MATLAB arrays. Specifically, it has all reasonably popular US affiliated movies made from 2000 through 2019 and all the actors and directors associated with them. Note that this is user contributed data, so it is neither complete nor guaranteed to be absolutely correct. Put the file in a new blank folder and issue the following command: >> load database If you now type the whos command, this is what you should see: >> whos Name Size Bytes Class Attributes actors 91605x2 1465680 double directors 2854x2 45664 double movies 1x2628 1960390 struct persons 1x51114 13137614 struct Notice that there are over 50,000 people and over 2,500 movies in the database. The persons array has a struct for every person in the database. For example: >> persons(1) ans = struct with fields: name: 'George Lucas' DOB: '5/14/1944' If the DOB is not available, and for many people, it is not, it will be an empty string. The movies array has one struct for every movie in the database. For example: >> movies(1) ans = struct with fields: title: 'Gladiator' mpaa: '' release: '05/01/2000' rating: 8.1000 votecount: 10921 countries: 'GB US' https://www.themoviedb.org/ The mpaa field is a string for the MPAA rating of the movie (G, PG, PG-13, R, NC-17). However, it is not available for most of the movies. The countries string contains the two-letter country codes separated by space. Note that the index into the persons and movies arrays are very important: the index is the ID of the given person or movie. This number is used to identify them in the other two arrays of the database. The actors array has two columns. Each row identifies an “acting” relationship: the first column is the movie ID, the second column is the person ID. For example: >> actors(1111,:) ans = 32 14590 >> movies(32).title ans = 'Remember the Titans' >> persons(14590) ans = struct with fields: name: 'Stuart Greer' DOB: '12/2/1959' This means that the movie “Remember the Titans” has an ID of 32, and actor Stuart Greer (who has the ID 14590) played in the movie. Similarly, the directors array specifies directing information. For example: >> directors(2746,:) ans = 2527 8868 >> movies(2527) ans = struct with fields: title: 'Avengers: Endgame' mpaa: 'PG' release: '04/24/2019' rating: 8.3000 votecount: 11209 countries: 'US' >> persons(8868) ans = struct with fields: name: 'Anthony Russo' DOB: '2/3/1970' That is, Anthony Russo directed “Avengers: Endgame”. Note that a movie may have more than one director (in this case, Joe Russo). Also note that the actual indices into the directors and actors arrays do not contain any significant information. These arrays are just collections of relationship information between movies and persons. However, they are typically stored in order of importance: the first entry for a particular movie will specify the first credited actor/actress. To illustrate how to use the information in the database, consider the following function: function films = search_for_movie(movies,keyword) films = []; keyword = upper(keyword); % to avoid capitalization issues for ii = 1:length(movies) if ~isempty(strfind(upper(movies(ii).title),keyword)) films(end+1) = ii; end end end This function finds all movies in the database whose title contains the keyword provided. For example: >> search_for_movie(movies,'Basterd') ans = 920 >> movies(920) ans = struct with fields: title: 'Inglourious Basterds' mpaa: '' release: '08/18/2009' rating: 8.1000 votecount: 13686 countries: 'DE US' If there is no matching movie, the function returns an empty array. You are free to use this function in your project. You will receive an individual assignment of 4 function problems out of the list of 20 below. Some have a single output argument, some have more than one. When asked for a person or movie, provide the ID of the person or movie, that is, the index in the persons or movies array and NOT the struct. Do NOT load the database inside your functions! Pass whatever array is needed by the function as an input argument just like in the example above. Note that some of the problems may require iterating through the various arrays multiple times. However, none of these functions should run for more than 20 seconds. The TAs will not have time to wait for each and every function to finish. Therefore, if your function runs longer than 20 seconds, it will be stopped and the solution will count as incorrect. Also, you may write additional helper functions, just make sure that you submit all m files needed to run your solutions! Before you submit, copy all the files you think you need into a blank folder and test your solution. Submit all these files except for the database.mat file. The difficulty level of the various problems are as follows (note that everybody gets one problem from each of the groups below): 1- 5: easy 6-10: moderate 11-15: getting harder 16-20: hard Problems (use the function name listed in parentheses): 1. Return the cast list (i.e., list of actors) of any movie. The movie ID is an input argument and the output is a vector of person IDs. (movie_cast) 2. Return the list of directors of any movie. The movie ID is an input argument and the output is a vector of person IDs. (movie_directors) 3. Return the list of movies a given person played in. The person ID is an input, while the output is a vector of movie IDs. (movies_by_actor) 4. Return the list of movies a given person directed. The person ID is an input, while the output is a vector of movie IDs. (movies_by_director) 5. Which movies are there in the database with an MPAA rating of R? Return a vector of movie IDs (r_rated) 6. Which movies are rated highest? Return a list of movie IDs that have the highest rating value. Note that there may be a single movie or multiple movies with the same maximum rating. (highest_rated) 7. Return the list of movies credited to a given country. The two-letter country code is an input and the output is a vector of movie IDs. (movies_by_country) 8. Which movies in the database have the most countries associated with it? Return a list of movie IDs. Note that there may be a single movie or multiple movies with the same number of countries credited. (most_countries) 9. Who is the oldest person (today) to direct a movie in the database? Only consider the birthyear. Disregard people with missing DOBs. Return a list of person IDs if there are multiple people with the same age. (oldest_director) 10. Return the list of movies a given director directed a given actor. The IDs of the director and the actor are input arguments and a vector of movie IDs is the output. (actor_directed_by) 11. Who played in the highest number of highly rated movies? Highly rated is defined as a rating greater than or equal to R, an input argument. Return a vector or person IDs if there is a tie. A second output is the number of highly rated movies the person(s) played in.
Answered 238 days AfterApr 05, 2021

Answer To: CS 1103 – Introductory Programming for Engineers and Scientists – Spring 2020 Project 2 This year...

Sathishkumar answered on Nov 27 2021
108 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here