我现在正在研究推荐系统。我设计了一个类 Recommend 像:
class Recommend{
Path path; //recommended path, self-defined class. This is the problem!
//some parameters and Models
private Map<Integer, List<Integer>> Model1;
//...other pram and models
//methods
public void getPath();
public double score(int place);//
}
这是我的问题:我构造了一个 Recommend 实例,加载模型。然后我通过调用该实例的 getPath 方法来搜索路径。我的路径是时间敏感的,其中包含位置列表以及正确的时间:
class Path{
List<Integer> path;
List<Integer> times;
double socre;
public void add(int place, double time);
}
我想调用 add(int, double) 为路径添加一个地点和对应的时间,同时更新新路径的分数。所以这里我要调用score(int),这是一个Recommend的方法
我应该如何设计 Path,它应该是 Recommend 的内部类吗?
更新
getPath(int place, double startTime);
//try greedy searching to find a time sensitive path that scored highest,
//go through all possible places and scored them.
socre(int place, double time);
//In fact there are multiple score methods correspond to different models,
//**and notice here I modify the param to int place from Path path**
//This function evaluates the score of current place and time(used in greedy searching)
add(int place, double time);
//add a new place and time(which is proved by greedy searching to be the best)
//I want this update the score of place itself...okay maybe I should place this function in Recommend