Googleの強みは 2008年度後期 情報システム構成論2 第10回 クラウドと協調フィルタリング 西尾 信彦 nishio@cs.ritsumei.ac.jp 立命館大学 情報理工学部 Cloud Computing 全地球規模で構成された圧倒的なPCクラスタ 部分的な機能不全を補う機能 あらゆる種類の情報へのサービスの提供 Web上の 全 情報 地図情報 (実世界情報) どのように利用されているかを機械学習 携帯電話への新展開 フリーソフトウェアで構成される開発基盤 Android ささえるのは世界一のインフラ 初期(1999年)の Googleクラスタ 膨大なPCクラスタにより構成 Googleは売っていないだけでPCの生産も自社用に行なっている 常にどこかのホストが壊れているても平気 クラウドコンピューティング 世界にコンピュータは5台だけ Google,Amazon,Yahoo,MS,IBM 世界中に分散するデータセンター 数十箇所 水力発電所のそばに設置 日本には法制上置けない 徹底した分散システム ファイルシステム Google File System データベースシステム Bigtable 分散処理システム MapReduce 最近のデータセンタ Google Chrome Comicより 1枚に4CPU 4枚の基板をコルク板 の上に集めて実装 しなう基板 HDDを空中実装 手作り 大量のケーブルと冷却 ファン Google File System Ubuntu LinuxのGoogle改良版をベース EXT3ファイルシステム テラバイトスケールのファイルの順次読み 書きに最適化 世界中のウェブデータを保存 数分で更新 Aggressiveなreplicationと分散アクセスによ る高速化 1
GFS: Master and Chunk servers Client Master Bigtable MySQL Relational DB( ) () ( ) URL etc Google MapReduce Map <, > Reduce Open source MapReduce Hadoop http://hadoop.apache.org/ Hadoop Distributed File System in place of GFS Let s look at an example: Reverse indexing for words We are not what we want to be, but at least we are not what we used to be. <we, 1> <are, 1> <not, 1> <what, 1> <we, 2> <to, 2> <be, 2> etc... Mapping Shuffling <we, 1> <we, 2> <we, 4> <we, 5> <are, 1> <are, 4> <not, 1> <not, 4> <what, 1> <what, 4> <to, 2> <to, 5> <be, 2> <be 5> <at, 3> <least, 3> <used, 5> 2
Reducing MapReduce Execution Overview <are, 1 4> <at, 3> <be, 2 5> <least, 3> <not, 1 4> <to, 2 5> <we, 1 2 4 5> <what, 1 4> <used, 5> MapReduce: Exectution Details Parallel Execution Machine Learning Technology Key Technology in Web 2.0: Recommendation: Collaborative Filtering Discovering groups: Clustering Support Vector Machine Bays Network And more Amazon: Recommendation Hello, Nobuhiko Nishio. We have recommendations for you. (Not Nobuhiko? ) Customers who bought this item also bought Most Helpful Customer Reviews 3
What Do Customers Ultimately Buy After Viewing This Item? 81% buy the item featured on this page:programming Collective Intelligence: Building Smart Web 2.0 Applications (36) $26.39 8% buyjavascript: The Good Parts (28) $19.79 4% buy Pragmatic Thinking and Learning: Refactor Your Wetware (Pragmatic Programmers) (9) $23.07 Example: Recommendation Collaborative Filtering is the basic technology for this. First introduced by David Goldberg at Xerox PARC in 1992. Let s see an example in Movie Reviewer s Web Site 4% buy Building Scalable Web Sites: Building, scaling, and optimizing the next generation of web applications (26) $26.39 Collected Preferences Who is similar to whom? Introduction of metric function Euclidean Distance Score Euclidean Distance Score in Python # Returns a distance-based similarity score for person1 and person2 def sim_distance(prefs,person1,person2): # Get the list of shared_items si={} for item in prefs[person1]: if item in prefs[person2]: si[item]=1 Who is similar to whom? Pearson Correlation Score Absorbs absolute evaluation difference. Corrects grade inflation # if they have no ratings in common, return 0 if len(si)==0: return 0 # Add up the squares of all the differences sum_of_squares=sum([pow(prefs[person1][item]-prefs[person2][item],2) for item in prefs[person1] if item in prefs[person2]]) return 1/(1+sum_of_squares) 4
# Returns the Pearson correlation coefficient for p1 and p2 def sim_pearson(prefs,p1,p2): # Get the list of mutually rated items si={} for item in prefs[p1]: if item in prefs[p2]: si[item]=1 # if they are no ratings in common, return 0 if len(si)==0: return 0 # Sum calculations n=len(si) # Sums of all the preferences sum1=sum([prefs[p1][it] for it in si]) sum2=sum([prefs[p2][it] for it in si]) # Sums of the squares sum1sq=sum([pow(prefs[p1][it],2) for it in si]) sum2sq=sum([pow(prefs[p2][it],2) for it in si]) # Sum of the products psum=sum([prefs[p1][it]*prefs[p2][it] for it in si]) # Calculate r (Pearson score) num=psum-(sum1*sum2/n) den=sqrt((sum1sq-pow(sum1,2)/n)*(sum2sq-pow(sum2,2)/n)) if den==0: return 0 r=num/den return r Personal Similarity Result Rose 0.99 Seymour 0.38 Puig 0.89 LaSalle 0.92 Matthews 0.66 Then? I (Toby) wants to have a movie recommendation not person. Creating recommendation for Toby The most similar person s favorite movies which I haven t seen? Too permissive! They might have not seen the good one that I might like. They might like the bad one that all other critics don t like. Movie Recommendation Result Let s aggregate the weighted remark summation for each movie! 5