├── .gitignore ├── .travis.yml ├── LICENSE ├── LoadData.py ├── ProbabilisticMatrixFactorization.py ├── README.md ├── RunExample.py ├── data └── ml-100k │ └── u.data ├── docs ├── 3208-probabilistic-matrix-factorization.pdf ├── PMF.png └── Probabilistic Matrix Factorization.pptx ├── requirements.txt └── test_pmf.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | 85 | # Spyder project settings 86 | .spyderproject 87 | 88 | # Rope project settings 89 | .ropeproject 90 | .idea/ 91 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.5" 4 | # command to install dependencies 5 | install: 6 | - pip install -r requirements.txt 7 | # command to run tests 8 | script: pytest -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LoadData.py: -------------------------------------------------------------------------------- 1 | from numpy import * 2 | import random 3 | 4 | 5 | def load_rating_data(file_path='ml-100k/u.data'): 6 | """ 7 | load movie lens 100k ratings from original rating file. 8 | need to download and put rating data in /data folder first. 9 | Source: http://www.grouplens.org/ 10 | """ 11 | prefer = [] 12 | for line in open(file_path, 'r'): # 打开指定文件 13 | (userid, movieid, rating, ts) = line.split('\t') # 数据集中每行有4项 14 | uid = int(userid) 15 | mid = int(movieid) 16 | rat = float(rating) 17 | prefer.append([uid, mid, rat]) 18 | data = array(prefer) 19 | return data 20 | 21 | 22 | def spilt_rating_dat(data, size=0.2): 23 | train_data = [] 24 | test_data = [] 25 | for line in data: 26 | rand = random.random() 27 | if rand < size: 28 | test_data.append(line) 29 | else: 30 | train_data.append(line) 31 | train_data = array(train_data) 32 | test_data = array(test_data) 33 | return train_data, test_data 34 | -------------------------------------------------------------------------------- /ProbabilisticMatrixFactorization.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import numpy as np 3 | 4 | 5 | class PMF(object): 6 | def __init__(self, num_feat=10, epsilon=1, _lambda=0.1, momentum=0.8, maxepoch=20, num_batches=10, batch_size=1000): 7 | self.num_feat = num_feat # Number of latent features, 8 | self.epsilon = epsilon # learning rate, 9 | self._lambda = _lambda # L2 regularization, 10 | self.momentum = momentum # momentum of the gradient, 11 | self.maxepoch = maxepoch # Number of epoch before stop, 12 | self.num_batches = num_batches # Number of batches in each epoch (for SGD optimization), 13 | self.batch_size = batch_size # Number of training samples used in each batches (for SGD optimization) 14 | 15 | self.w_Item = None # Item feature vectors 16 | self.w_User = None # User feature vectors 17 | 18 | self.rmse_train = [] 19 | self.rmse_test = [] 20 | 21 | # ***Fit the model with train_tuple and evaluate RMSE on both train and test data. ***********# 22 | # ***************** train_vec=TrainData, test_vec=TestData*************# 23 | def fit(self, train_vec, test_vec): 24 | # mean subtraction 25 | self.mean_inv = np.mean(train_vec[:, 2]) # 评分平均值 26 | 27 | pairs_train = train_vec.shape[0] # traindata 中条目数 28 | pairs_test = test_vec.shape[0] # testdata中条目数 29 | 30 | # 1-p-i, 2-m-c 31 | num_user = int(max(np.amax(train_vec[:, 0]), np.amax(test_vec[:, 0]))) + 1 # 第0列,user总数 32 | num_item = int(max(np.amax(train_vec[:, 1]), np.amax(test_vec[:, 1]))) + 1 # 第1列,movie总数 33 | 34 | incremental = False # 增量 35 | if ((not incremental) or (self.w_Item is None)): 36 | # initialize 37 | self.epoch = 0 38 | self.w_Item = 0.1 * np.random.randn(num_item, self.num_feat) # numpy.random.randn 电影 M x D 正态分布矩阵 39 | self.w_User = 0.1 * np.random.randn(num_user, self.num_feat) # numpy.random.randn 用户 N x D 正态分布矩阵 40 | 41 | self.w_Item_inc = np.zeros((num_item, self.num_feat)) # 创建电影 M x D 0矩阵 42 | self.w_User_inc = np.zeros((num_user, self.num_feat)) # 创建用户 N x D 0矩阵 43 | 44 | while self.epoch < self.maxepoch: # 检查迭代次数 45 | self.epoch += 1 46 | 47 | # Shuffle training truples 48 | shuffled_order = np.arange(train_vec.shape[0]) # 根据记录数创建等差array 49 | np.random.shuffle(shuffled_order) # 用于将一个列表中的元素打乱 50 | 51 | # Batch update 52 | for batch in range(self.num_batches): # 每次迭代要使用的数据量 53 | # print "epoch %d batch %d" % (self.epoch, batch+1) 54 | 55 | test = np.arange(self.batch_size * batch, self.batch_size * (batch + 1)) 56 | batch_idx = np.mod(test, shuffled_order.shape[0]) # 本次迭代要使用的索引下标 57 | 58 | batch_UserID = np.array(train_vec[shuffled_order[batch_idx], 0], dtype='int32') 59 | batch_ItemID = np.array(train_vec[shuffled_order[batch_idx], 1], dtype='int32') 60 | 61 | # Compute Objective Function 62 | pred_out = np.sum(np.multiply(self.w_User[batch_UserID, :], 63 | self.w_Item[batch_ItemID, :]), 64 | axis=1) # mean_inv subtracted # np.multiply对应位置元素相乘 65 | 66 | rawErr = pred_out - train_vec[shuffled_order[batch_idx], 2] + self.mean_inv 67 | 68 | # Compute gradients 69 | Ix_User = 2 * np.multiply(rawErr[:, np.newaxis], self.w_Item[batch_ItemID, :]) \ 70 | + self._lambda * self.w_User[batch_UserID, :] 71 | Ix_Item = 2 * np.multiply(rawErr[:, np.newaxis], self.w_User[batch_UserID, :]) \ 72 | + self._lambda * (self.w_Item[batch_ItemID, :]) # np.newaxis :increase the dimension 73 | 74 | dw_Item = np.zeros((num_item, self.num_feat)) 75 | dw_User = np.zeros((num_user, self.num_feat)) 76 | 77 | # loop to aggreate the gradients of the same element 78 | for i in range(self.batch_size): 79 | dw_Item[batch_ItemID[i], :] += Ix_Item[i, :] 80 | dw_User[batch_UserID[i], :] += Ix_User[i, :] 81 | 82 | # Update with momentum 83 | self.w_Item_inc = self.momentum * self.w_Item_inc + self.epsilon * dw_Item / self.batch_size 84 | self.w_User_inc = self.momentum * self.w_User_inc + self.epsilon * dw_User / self.batch_size 85 | 86 | self.w_Item = self.w_Item - self.w_Item_inc 87 | self.w_User = self.w_User - self.w_User_inc 88 | 89 | # Compute Objective Function after 90 | if batch == self.num_batches - 1: 91 | pred_out = np.sum(np.multiply(self.w_User[np.array(train_vec[:, 0], dtype='int32'), :], 92 | self.w_Item[np.array(train_vec[:, 1], dtype='int32'), :]), 93 | axis=1) # mean_inv subtracted 94 | rawErr = pred_out - train_vec[:, 2] + self.mean_inv 95 | obj = np.linalg.norm(rawErr) ** 2 \ 96 | + 0.5 * self._lambda * (np.linalg.norm(self.w_User) ** 2 + np.linalg.norm(self.w_Item) ** 2) 97 | 98 | self.rmse_train.append(np.sqrt(obj / pairs_train)) 99 | 100 | # Compute validation error 101 | if batch == self.num_batches - 1: 102 | pred_out = np.sum(np.multiply(self.w_User[np.array(test_vec[:, 0], dtype='int32'), :], 103 | self.w_Item[np.array(test_vec[:, 1], dtype='int32'), :]), 104 | axis=1) # mean_inv subtracted 105 | rawErr = pred_out - test_vec[:, 2] + self.mean_inv 106 | self.rmse_test.append(np.linalg.norm(rawErr) / np.sqrt(pairs_test)) 107 | 108 | # Print info 109 | if batch == self.num_batches - 1: 110 | print('Training RMSE: %f, Test RMSE %f' % (self.rmse_train[-1], self.rmse_test[-1])) 111 | 112 | def predict(self, invID): 113 | return np.dot(self.w_Item, self.w_User[int(invID), :]) + self.mean_inv # numpy.dot 点乘 114 | 115 | # ****************Set parameters by providing a parameter dictionary. ***********# 116 | def set_params(self, parameters): 117 | if isinstance(parameters, dict): 118 | self.num_feat = parameters.get("num_feat", 10) 119 | self.epsilon = parameters.get("epsilon", 1) 120 | self._lambda = parameters.get("_lambda", 0.1) 121 | self.momentum = parameters.get("momentum", 0.8) 122 | self.maxepoch = parameters.get("maxepoch", 20) 123 | self.num_batches = parameters.get("num_batches", 10) 124 | self.batch_size = parameters.get("batch_size", 1000) 125 | 126 | def topK(self, test_vec, k=10): 127 | inv_lst = np.unique(test_vec[:, 0]) 128 | pred = {} 129 | for inv in inv_lst: 130 | if pred.get(inv, None) is None: 131 | pred[inv] = np.argsort(self.predict(inv))[-k:] # numpy.argsort索引排序 132 | 133 | intersection_cnt = {} 134 | for i in range(test_vec.shape[0]): 135 | if test_vec[i, 1] in pred[test_vec[i, 0]]: 136 | intersection_cnt[test_vec[i, 0]] = intersection_cnt.get(test_vec[i, 0], 0) + 1 137 | invPairs_cnt = np.bincount(np.array(test_vec[:, 0], dtype='int32')) 138 | 139 | precision_acc = 0.0 140 | recall_acc = 0.0 141 | for inv in inv_lst: 142 | precision_acc += intersection_cnt.get(inv, 0) / float(k) 143 | recall_acc += intersection_cnt.get(inv, 0) / float(invPairs_cnt[int(inv)]) 144 | 145 | return precision_acc / len(inv_lst), recall_acc / len(inv_lst) 146 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Python Implementation of Probabilistic Matrix Factorization Algorithm 2 | 3 | The code attempts to implement the following paper: 4 | 5 | > *Mnih, A., & Salakhutdinov, R. (2007). Probabilistic matrix factorization. In Advances in neural information processing systems (pp. 1257-1264).* 6 | 7 | Probabilistic Matrix Factorization in Python with MovieLens dataset 8 | 9 | ![image](https://github.com/fuhailin/Probabilistic-Matrix-Factorization/blob/master/docs/PMF.png) 10 | 11 | The dataset is a copy of the MovieLens | GroupLens 12 | dataset in the `MovieLens 100k | GroupLens ` 13 | 14 | ### Reference: 15 | 1. Mnih, A., & Salakhutdinov, R. (2007). Probabilistic matrix factorization. In Advances in neural information processing systems (pp. 1257-1264). 16 | 2. Salakhutdinov, R. Probabilistic matrix factorization in Matlab. http://www.utstat.toronto.edu/~rsalakhu/BPMF.html. 17 | -------------------------------------------------------------------------------- /RunExample.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import numpy as np 3 | from LoadData import load_rating_data, spilt_rating_dat 4 | from sklearn.model_selection import train_test_split 5 | from ProbabilisticMatrixFactorization import PMF 6 | 7 | if __name__ == "__main__": 8 | file_path = "data/ml-100k/u.data" 9 | pmf = PMF() 10 | pmf.set_params({"num_feat": 10, "epsilon": 1, "_lambda": 0.1, "momentum": 0.8, "maxepoch": 10, "num_batches": 100, 11 | "batch_size": 1000}) 12 | ratings = load_rating_data(file_path) 13 | print(len(np.unique(ratings[:, 0])), len(np.unique(ratings[:, 1])), pmf.num_feat) 14 | train, test = train_test_split(ratings, test_size=0.2) # spilt_rating_dat(ratings) 15 | pmf.fit(train, test) 16 | 17 | # Check performance by plotting train and test errors 18 | plt.plot(range(pmf.maxepoch), pmf.rmse_train, marker='o', label='Training Data') 19 | plt.plot(range(pmf.maxepoch), pmf.rmse_test, marker='v', label='Test Data') 20 | plt.title('The MovieLens Dataset Learning Curve') 21 | plt.xlabel('Number of Epochs') 22 | plt.ylabel('RMSE') 23 | plt.legend() 24 | plt.grid() 25 | plt.show() 26 | print("precision_acc,recall_acc:" + str(pmf.topK(test))) 27 | -------------------------------------------------------------------------------- /docs/3208-probabilistic-matrix-factorization.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fuhailin/Probabilistic-Matrix-Factorization/5583fa2915058d5dd3087b4873a3eb6288b9b779/docs/3208-probabilistic-matrix-factorization.pdf -------------------------------------------------------------------------------- /docs/PMF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fuhailin/Probabilistic-Matrix-Factorization/5583fa2915058d5dd3087b4873a3eb6288b9b779/docs/PMF.png -------------------------------------------------------------------------------- /docs/Probabilistic Matrix Factorization.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fuhailin/Probabilistic-Matrix-Factorization/5583fa2915058d5dd3087b4873a3eb6288b9b779/docs/Probabilistic Matrix Factorization.pptx -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy -------------------------------------------------------------------------------- /test_pmf.py: -------------------------------------------------------------------------------- 1 | # content of test_sample.py 2 | def inc(x): 3 | return x + 1 4 | 5 | def test_pmf(): 6 | inc(3) == 5 --------------------------------------------------------------------------------