diff --git a/src/main/java/com/tarzan/recommend/RecommendSystemApplication.java b/src/main/java/com/tarzan/recommend/RecommendSystemApplication.java index 1b8fa68..3360e3e 100644 --- a/src/main/java/com/tarzan/recommend/RecommendSystemApplication.java +++ b/src/main/java/com/tarzan/recommend/RecommendSystemApplication.java @@ -12,10 +12,10 @@ public class RecommendSystemApplication { public static void main(String[] args) { //SpringApplication.run(RecommendSystemApplication.class, args); System.out.println("------基于用户协同过滤推荐---------------下列电影"); - List itemList= Recommend.userCfRecommend(2); + List itemList= Recommend.userCfRecommend(1); itemList.forEach(e-> System.out.println(e.getName())); System.out.println("------基于物品协同过滤推荐---------------下列电影"); - List itemList1= Recommend.itemCfRecommend(2); + List itemList1= Recommend.itemCfRecommend(1); itemList1.forEach(e-> System.out.println(e.getName())); } diff --git a/src/main/java/com/tarzan/recommend/core/CoreMath.java b/src/main/java/com/tarzan/recommend/core/CoreMath.java index c64637b..8a9fd1f 100644 --- a/src/main/java/com/tarzan/recommend/core/CoreMath.java +++ b/src/main/java/com/tarzan/recommend/core/CoreMath.java @@ -33,8 +33,8 @@ public class CoreMath { //关系系数 double coefficient = relateDist(v,userItems,type); //关系距离 - double distance=Math.abs(coefficient); - distMap.put(k,distance); + // double distance=Math.abs(coefficient); + distMap.put(k,coefficient); } }); return distMap; diff --git a/src/main/resources/ml-100k/u.data-test b/src/main/resources/ml-100k/u.data-test new file mode 100644 index 0000000..7a758cf --- /dev/null +++ b/src/main/resources/ml-100k/u.data-test @@ -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