????1.????
??????????????????????????????????Items?????к?????????????????????????????????Items????????????????????????????????????????????????????????????????????????????ж??????????????????????????????Щ?????????????????????????????????????????Э????????????????????Э??????????????Э??????
?????????????Э????????????????????????????
?????????????Э????????????????????????????
????2.???
????????Э???????????????????У??????????????????????????????????????????????Э??????

???????????д??????????????д????????????????2?е???е?3??????2?????1???????3??0???????????????й???????????????????????2?????4???????
????????????4???????????????1??3??5??8??9??10???????????4?? 2?? 1?? 3?? 3?? 1
?????????????2?????1??3??5??8??9??10??????????????????????к?????????3???????????????????????????????????????鵽???????????????????????????
????????????2?????1??????????????????????????????????????1?? 2?? 9?? 10?????1????4????????????????r1=[5 3 4 4]?????2????4??????????????r2=[3 1 1 2];??ν??????????????????????????н???????????????????????????????????н??С????????????????????????????????????????????2?????1??????????sim2_1=(5*3 + 3*1 + 4*1 + 4*2)/ (||r1|| * ||r2||) = 0.953?? ????||r||????????r?????????2????????????????????2?????3 5 8 9 10????sim2_3??sim2_5??sim2_8??sim2_9??sim2_10
???????????????????????2?????4??????????predict = 4*sim2_1 + 2*sim2_3 + 1*sim2_5 + 3*sim2_8 + 3*sim2_9 + 1*sim2_10
???????????????????????????????????????????????????????????
????3.???
????????Matlab????????ο???http://blog.csdn.net/google19890102/article/details/28112091??????????C++????????movielens.rar???в??????????????????????????????????????????????
????????????????????????????????????

 

#ifndef LOAD_H
#define LOAD_H
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
using namespace std;
template <typename T>
vector<vector<T> > txtRead(string FilePath??int row??int col)
{
ifstream input(FilePath);
if (!input.is_open())
{
cerr << "File is not existing?? check the path: " <<  FilePath << endl;
exit(1);
}
vector<vector<T> > data(row?? vector<T>(col??0));
for (int i = 0; i < row; ++i)
{
for (int j = 0; j < col; ++j)
{
input >> data[i][j];
}
}
return data;
}
template<typename T>
void txtWrite(vector<vector<T> > Matrix?? string dest)
{
ofstream output(dest);
vector<vector<T> >::size_type row = Matrix.size();
vector<T>::size_type col = Matrix[0].size();
for (vector<vector<T> >::size_type i = 0; i < row; ++i)
{
for (vector<T>::size_type j = 0; j < col; ++j)
{
output << Matrix[i][j];
}
output << endl;
}
}
#endif

???????????????????????RMSE??????