bug修改
This commit is contained in:
@@ -12,10 +12,10 @@ public class RecommendSystemApplication {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
//SpringApplication.run(RecommendSystemApplication.class, args);
|
//SpringApplication.run(RecommendSystemApplication.class, args);
|
||||||
System.out.println("------基于用户协同过滤推荐---------------下列电影");
|
System.out.println("------基于用户协同过滤推荐---------------下列电影");
|
||||||
List<ItemDTO> itemList= Recommend.userCfRecommend(2);
|
List<ItemDTO> itemList= Recommend.userCfRecommend(1);
|
||||||
itemList.forEach(e-> System.out.println(e.getName()));
|
itemList.forEach(e-> System.out.println(e.getName()));
|
||||||
System.out.println("------基于物品协同过滤推荐---------------下列电影");
|
System.out.println("------基于物品协同过滤推荐---------------下列电影");
|
||||||
List<ItemDTO> itemList1= Recommend.itemCfRecommend(2);
|
List<ItemDTO> itemList1= Recommend.itemCfRecommend(1);
|
||||||
itemList1.forEach(e-> System.out.println(e.getName()));
|
itemList1.forEach(e-> System.out.println(e.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public class CoreMath {
|
|||||||
//关系系数
|
//关系系数
|
||||||
double coefficient = relateDist(v,userItems,type);
|
double coefficient = relateDist(v,userItems,type);
|
||||||
//关系距离
|
//关系距离
|
||||||
double distance=Math.abs(coefficient);
|
// double distance=Math.abs(coefficient);
|
||||||
distMap.put(k,distance);
|
distMap.put(k,coefficient);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return distMap;
|
return distMap;
|
||||||
|
|||||||
10
src/main/resources/ml-100k/u.data-test
Normal file
10
src/main/resources/ml-100k/u.data-test
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
1 1 1 847117005
|
||||||
|
1 2 10 847642142
|
||||||
|
1 3 1 847641896
|
||||||
|
2 1 2 847642008
|
||||||
|
2 3 2 847641956
|
||||||
|
3 1 3 847641956
|
||||||
|
3 3 3 847642073
|
||||||
|
4 1 4 847642105
|
||||||
|
4 2 1 847116751
|
||||||
|
4 3 5 847116787
|
||||||
Reference in New Issue
Block a user