coursera機器學習第九周最後測驗--推薦系統(帶解題思路)

1. Suppose you run a bookstore, and have ratings (1 to 5 stars) of books. Your collaborative filtering algorithm has learned a parameter vector θ(j) for user j, and a feature vector x(i) for each book. You would like to compute the "training error", meaning the average squared error of your system's predictions on all the ratings that you have gotten from your users. Which of these are correct ways of doing so (check all that apply)? For this problem, let m be the total number of ratings you have gotten from your users. (Another way of saying this is that . [Hint: Two of the four options below are correct.]

答:選AC,這是基本概念題了,這裏需要注意theta的下標,不要搞混了

2. In which of the following situations will a collaborative filtering system be the most appropriate learning algorithm (compared to linear or logistic regression)?

You've written apiece of software that has downloaded news articles from many news websites. In your system, you also keep track of which articles you personally like vs.dislike, and the system also stores away features of these articles (e.g., word counts, name of author). Using this information, you want to build a system to try to find additional new articles that you personally will like.

You manage an online bookstore and you have the book ratings from many users. For each user,you want to recommend other books she will enjoy, based on her own ratings and the ratings of other users.

You manage an online bookstore and you have the book ratings from many users. You want to learn to predict the expected sales volume (number of books sold) as a function of the average rating of a book.

You run an online news aggregator, and for every user, you know some subset of articles that the user likes and some different subset that the user dislikes. You'd want to use this to find other articles that the user likes.

答:選B、D  協同過濾算法的特點是其特徵量和數據比較多。

A:你已經編寫了一個下載許多網站裏新聞文章的軟件。在您的系統中,您還可以跟蹤您個人喜歡與不喜歡的文章,並且系統還存儲這些文章的特徵(例如,單詞計數、作者姓名)。使用此信息,您想要構建一個系統來嘗試查找您個人喜歡的其他新文章。

這個開始我也選錯了,認爲是正確的,目前還沒理解,理解後再更新,博友有想法的也可以評論告訴我,謝謝。

B:你管理anonline書店,你有很多用戶的書評分。對於每個用戶,您都希望根據自己的評分和其他用戶的評分推薦其他喜歡的書籍。    這個和課堂講的推薦電影類似,就是推薦系統。

C:你管理anonline書店,你有很多用戶的書評分。您想要根據書的平均評分來預測預期的銷售量(銷售的書籍數量)。 很明顯這個預測用線性迴歸等其他算法好,協同過濾算法在推薦系統方面的應用更廣。

D:運行一個OnLeNeNS聚合器,對於每個用戶,您知道用戶喜歡的一些子集和用戶不喜歡的一些不同的子集。你想用這個來找到用戶喜歡的其他文章。 這個推薦系統和B類似

3 . You run a movie empire, and want to build a movie recommendation system based on collaborative filtering. There were three popular review websites (which we'll call A, B and C) which users to go to rate movies, and you have just acquired all three companies that run these websites. You'd like to merge the three companies'data sets together to build a single/unified system. On website A, users rank a movie as having 1 through 5 stars. On website B, users rank on a scale of 1 -10, and decimal values (e.g., 7.5) are allowed. On website C, the ratings are from 1 to 100. You also have enough information to identify users/movies on one website with users/movies on a different website. Which of the following statements is true?

It is notpossible to combine these websites' data. You must build three separaterecommendation systems.

You can combineall three training sets into one without any modification and expect highperformance from a recommendation system.

You can merge the three datasets into one, but you should first normalize each dataset's ratings(say rescale each dataset's ratings to a 1-100 range).

Assuming that there is at least one movie/user in one database that doesn't also appear in asecond database, there is no sound way to merge the datasets, because of the missing data.

答:選C,因爲ABC每個樣本的均值均不一樣,要想將三個樣本歸爲一類,類似於前面線性迴歸、邏輯迴歸等提到的方法,需要對每個類進行特徵縮放後方能總體歸爲一類。而課堂裏電影的評級並沒有特徵縮放時因爲所有電影評級已經是可比(例如1--5星),所以他們的規模相似,無須特徵縮放。注意與本題的區別。

4.  

Which of the following are true of collaborative filtering systems? Check all that apply.

Suppose you are writing a recommender system to predict a user's book preferences. In order to build such a system, you need that user to rate all the other books in your training set.

For collaborative filtering, the optimization algorithm you should use is gradient descent. In particular, you cannot use more advanced optimization algorithms(L-BFGS/conjugate gradient/etc.) for collaborative filtering, since you have to solve for both the x(i)'s and θ(j)'s simultaneously.

For collaborative filtering, it is possible to use one of the advanced optimization algoirthms (L-BFGS/conjugate gradient/etc.) to solve for both the x(i)'s and θ(j)'s  simultaneously.

Even if each user has rated only a small fraction of all of your products (so r(i,j)=0 for the vast majority of (i,j) pairs),you can still build a recommender system by using collaborative filtering.

答:選 C、D

A:假設您正在編寫推薦系統來預測用戶的圖書偏好。爲了構建這樣一個系統,你需要用戶對你的訓練集中的所有其他書籍進行評分。 實際上沒必要對所有書進行評分

B:對於協作過濾算法,您應該使用的優化算法是漸變下降。特別是,您不能使用更高級的優化算法(L-BFGS /共軛梯度/等)進行協同過濾,因爲您必須解決同時更新x(i)和θ(j)的問題。 可以使用其他更高級算法,課件上提到過。

5.  

Suppose you have two matrices A and B, where A is 5x3 and B is 3x5. Their product is C=AB, a 5x5 matrix.Furthermore, you have a 5x5 matrix R where every entry is 0 or 1. You want to find the sum of all elements C(i,j) for which the corresponding R(i,j) is 1, and ignore all elements C(i,j) where R(i,j)=0. One way to do so is the following code:

 

Which of the following pieces of Octave code will also correctly compute this total? Check all that apply. Assume all options are in code.

total =sum(sum((A * B) .* R))

C = (A * B) .*R; total = sum(C(:));

total =sum(sum((A * B) * R));

C = (A * B) * R;total = sum(C(:));

答: 選A、B

這裏主要就是將C中元素對應於R中元素爲1的位置的元素求和。所以這裏必須要用到點乘,因爲這裏是5x5矩陣之間相乘,用一般的矩陣相乘還是5x5的矩陣,沒辦法選擇出單個位置上的元素。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章