您的位置:首页 > 编程语言 > Java开发

用Java 实现简单的推荐系统

2017-03-28 19:17 387 查看
例子:

package recommender;

import java.util.Arrays;

/**
* Created by legotime
*/
public class recommendTest {
public static void main(String[] args) {
String person1 = "dog cate pen cake pie";
String person2 = "dog cat water coco";
String person3 = "pie cake pen cate";
String[] products = {person1,person3,person3};
recommend rec = new recommend();
rec.fit(products);
double[] doubles = rec.recommendFun(person3);
System.out.println(Arrays.toString(doubles));
System.out.println(rec.getProduct());
//[cake, cat, cate, coco, dog, pen, pie, water]
//[0.0, 0.0, 0.0, 0.0, 0.8, 0.0, 0.0, 0.0]

//所以推荐 买了 pie cake pen cate 的人买 dog
}

}


具体访问:

https://github.com/lego-time/SampleRecommender
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: