STAT 7008 - Assignment 1Due Date by 5 Oct 2018 numpy 和panda的使用是不被允许的The use of numpy and pandas in this assignment are prohibited. You willreceive zero marks to solve problems in this assignment if you use thementioned packages.Question 11. Please write codes to read the data file TrainingData.csv.The first row is the header (variable names). Data are stored insubsequent rows. 读csv2. Determine the number of variables and the number of records in thisdataset. 变量和记录数3. Store the variable names in a list. 保存在list4. Determine if there is any missing values in the data set. If yes, pleasereport the total number of missing values.是否有缺失5. Find the number of distinct LCID in the data set. LCID6. Find the variable with the most missing values.7. Convert the variable hour_id to datetime format.8. What is the time duration of the entire data set? 时间长度9. Determine the number of records per day.每天的记录数10. Use the median method in the statistics package (from statisticsimport median) or else, do the followings:(a) Divide the entire data set by distinct value of LCID.(b) For each distinct LCID value, determine the median of eachvariables in the divided data set.(c) Package the result in (b) in a dictionary.11. Determine the number of Complaint cases and Non-complaint casesin the entire data set.12. Determine the top 10 LCIDs with the most complaint cases.13. Calculate the median value per day per each variable in the entire dataset.14. Use the first 5 digits of the LCID values to define a new variable Region.15. Determine the region with the most complaint cases found in the dataset. Question 2The objective of this part is to employ the provided data sets u.data andu.item to develop a movie recommender.u.data consists of user ratings on a set of movies. The last columncorresponds to time stamps relative to 1st Jan 1970. Column names foru.data are [userid,movieid,rating,timestamp].u.item represents the set of movies defined in u.data. The column names foru.item are [movieid, title, release, url, unknown, Action,Ad代写STAT 7008作业、csv数据报告作业代写、帮做LCID值作业分析、CVS/Matlab程序数据分析作业代做 代venture, Animation, Children, Comedy, Crime, Documentary,Drama, Fantasy, Film-Noir, Horror, Musical, Mystery, Romance,Sci-Fi, Thriller, War, Western].You can also download the two data files fromhttp://grouplens.org/datasets/movielens/.1. Import the two data files with an appropriate separator. Do thefollowings:(a) Set the timestamp variable to its datetime format usingdatetime.fromtimestamp() method.(b) Add leading zeros to the movieid and userid with zfill(4) method,e.g. 0023.2. Remove movies with title = unknown.3. Find the average ratings and the number of reviews for all movies inu.item.4. Write a function to list the top n (e.g. 10) rated movies, title namesand their number of reviews.5. Considering that a movie with a higher number of reviews should havegiven a higher weight, we adjust the average rating formula byincorporating c hypothetical users. These users rate each movie withrating m. Use c = 59 and m = 3, write a function to list the top n ratedmovies, title names and their number of reviews using the adjustedaverage formula. Compare the listing with that found in question 4.Which one is more reasonable?6. For two distinct users A and B, find the set of movies common to bothusers, that is the set of movies both users have given ratings. Applythe Euclidean distance formula on the two sets of ratings to determinea distance between user A and user B. Write a distance function withuserid of A and userid of B as input. The output of the function is1/(1+d(A,B)), where d(A,B) is the distance between user A and user B.7. Given a user, write a function to determine and output a list ofdistances between the given user and others. Mark the distances withtheir users.8. Write a function with a given user and a given movie. If the movie wasrated by the user, output the rating provided. If the movie was notrated by the user, output the weighted average of the ratings of allother users weighted by their distances with the given user.9. Hence, given a user, write a function to suggest 10 movies.转自:http://ass.3daixie.com/2018100277784281.html
讲解:STAT 7008、csv、LCID、CVS/MatlabPython|Web
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- By clicking to agree to this Schedule 2, which is hereby ...