提交 34b50f59 编写于 作者: T Tom Qian

modification according to user's feedback about a null pointer exception

sth new
上级 e037e461
......@@ -39,7 +39,7 @@
|字段名|类型|非空|主键|外键|自增|默认值|
|--|--|--|--|--|--|--|
|id|bigint|yes|yes||yes||
|pref_list|text|yes||||{}|
|pref_list|text|yes||||{"moduleid1":{},"moduleid2":{},...}|
|latest_log_time|timestamp|yes|||||
- 新闻表news
......@@ -193,7 +193,7 @@ new TestDataRunner().runTestData();
- 若对测试数据进行一次协同过滤,将生成0条推荐。
- 若对测试数据进行一次基于内容的推荐,将为用户1(id=1)推荐85,87,89,104这四条新闻(有重复标题的新闻,新闻标题中的“合同”关键词匹配上了用户的喜好关键词),为用户2推荐89新闻(重复标题的新闻),推荐用户3推荐87,85,100这三条新闻(新闻标题中的“合同”关键词匹配上了用户的喜好关键词)。
- 若对测试数据进行一次基于热点新闻的推荐,将为每个用户生成20条推荐结果
- 若对测试数据进行一次基于热点新闻的推荐,将分别为用户1推荐103,104,为用户2推荐100,104,为用户3推荐100,101,因为最近被浏览得最多的新闻就是这三个拥有浏览记录的用户看过的那些新闻(100,101,102,103,104)
## 额外说明
......
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
文件模式从 100644 更改为 100755
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>top.tomqian</groupId>
<artifactId>recommender-system</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.jfinal/jfinal -->
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.ansj/ansj_seg -->
<dependency>
<groupId>org.ansj</groupId>
<artifactId>ansj_seg</artifactId>
<version>5.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mchange/c3p0 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mahout/mahout-core -->
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-core</artifactId>
<version>0.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mahout/mahout-integration -->
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-integration</artifactId>
<version>0.12.2</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.1</version>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>top.tomqian</groupId>
<artifactId>recommender-system</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.jfinal/jfinal -->
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.ansj/ansj_seg -->
<dependency>
<groupId>org.ansj</groupId>
<artifactId>ansj_seg</artifactId>
<version>5.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mchange/c3p0 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mahout/mahout-core -->
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-core</artifactId>
<version>0.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mahout/mahout-integration -->
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-integration</artifactId>
<version>0.12.2</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.1</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
url = jdbc:mysql://[ip]/[database]?useUnicode=true&characterEncoding=utf8
url = jdbc:mysql://[ip]/[database]]?useUnicode=true&characterEncoding=utf8
user =
password =
\ No newline at end of file
文件模式从 100644 更改为 100755
package top.qianxinyao.Main;
import org.apache.log4j.Logger;
/**
......
文件模式从 100644 更改为 100755
......@@ -20,6 +20,7 @@ public class TestDataRunner
System.out.println("开始测试数据的运行!");
//选择要在推荐系统中运行的推荐算法
//协同过滤Collaborative Filtering,基于内容相似度的推荐Content-based,基于热点新闻推荐HotNewsRecommendation
boolean enableCF=false,enableCB=true,enableHR=false;
JobSetter jobSetter=new JobSetter(enableCF,enableCB,enableHR);
......@@ -38,6 +39,7 @@ public class TestDataRunner
System.out.println("测试数据运行结束!");
}
//对测试数据的相关日期数据进行更新,以保证能够在测试运行中获得理想的推荐结果。
public void databaseReady() {
Db.update("update news set news_time=?",new Date());
for(int id=1;id<8;id++) {
......
......@@ -124,7 +124,6 @@ public class JsonKit
CustomizedHashMap<Integer,CustomizedHashMap<String,Double>> map=null;
try
{
System.out.println("srcJson:"+srcJson);
map=objectMapper.readValue(srcJson, new TypeReference<CustomizedHashMap<Integer,CustomizedHashMap<String,Double>>>(){});
}
catch (JsonParseException e)
......
......@@ -18,6 +18,7 @@ import org.apache.log4j.Logger;
import top.qianxinyao.contentbasedrecommend.CustomizedHashMap;
import top.qianxinyao.model.News;
import top.qianxinyao.model.Newslogs;
import top.qianxinyao.model.Recommendations;
import top.qianxinyao.model.Users;
......@@ -96,12 +97,12 @@ public class RecommendKit
{
try
{
List<News> newsList = News.dao.find("select news_id from newslogs where user_id=?",userId);
for (News news:newsList)
List<Newslogs> newslogsList = Newslogs.dao.find("select news_id from newslogs where user_id=?",userId);
for (Newslogs newslog:newslogsList)
{
if (col.contains(news.getId()))
if (col.contains(newslog.getNewsId()))
{
col.remove(news.getId());
col.remove(newslog.getNewsId());
}
}
}
......@@ -119,12 +120,13 @@ public class RecommendKit
{
try
{
List<News> newsList = News.dao.find("select news_id from recommendations where user_id=? and derive_time>?",userId,getInRecDate());
for (News news:newsList)
//但凡近期已经给用户推荐过的新闻,都过滤掉
List<Recommendations> recommendationList = Recommendations.dao.find("select news_id from recommendations where user_id=? and derive_time>?",userId,getInRecDate());
for (Recommendations recommendation:recommendationList)
{
if (col.contains(news.getId()))
if (col.contains(recommendation.getNewsId()))
{
col.remove(news.getId());
col.remove(recommendation.getNewsId());
}
}
}
......@@ -264,6 +266,7 @@ public class RecommendKit
rec.setUserId(userId);
rec.setDeriveAlgorithm(recAlgo);
rec.setNewsId(newsIte.next());
rec.save();
}
}
catch (Exception e)
......
......@@ -95,6 +95,7 @@ public class ContentBasedRecommender implements RecommendAlgorithm
RecommendKit.filterReccedNews(toBeRecommended,userId);
//过滤掉用户已经看过的新闻
RecommendKit.filterBrowsedNews(toBeRecommended, userId);
//如果可推荐新闻数目超过了系统默认为CB算法设置的单日推荐上限数(N),则去掉一部分多余的可推荐新闻,剩下的N个新闻才进行推荐
if(toBeRecommended.size()>N){
RecommendKit.removeOverNews(toBeRecommended,N);
}
......
......@@ -24,7 +24,8 @@ import top.qianxinyao.model.Users;
* @author qianxinyao
* @email tomqianmaple@gmail.com
* @github https://github.com/bluemapleman
* @date 2016年11月3日 每次用户浏览新的新闻时,用以更新用户的喜好关键词列表
* @date 2016年11月3日
* 每次用户浏览新的新闻时,用以更新用户的喜好关键词列表
*/
public class UserPrefRefresher
{
......@@ -38,12 +39,21 @@ public class UserPrefRefresher
refresh(RecommendKit.getUserList());
}
/**
* 按照推荐频率调用的方法,一般为一天执行一次。
* 定期根据前一天所有用户的浏览记录,在对用户进行喜好关键词列表TFIDF值衰减的后,将用户前一天看的新闻的关键词及相应TFIDF值更新到列表中去。
* @param userIdsCol
*/
@SuppressWarnings("unchecked")
public void refresh(Collection<Long> userIdsCol){
//首先对用户的喜好关键词列表进行衰减更新
autoDecRefresh(userIdsCol);
//用户浏览新闻纪录:userBrowsexMap:<Long(userid),ArrayList<String>(newsid List)>
HashMap<Long,ArrayList<Long>> userBrowsedMap=getBrowsedHistoryMap();
//如果前一天没有浏览记录(比如新闻门户出状况暂时关停的情况下,或者初期用户较少的时候均可能出现这种情况),则不需要执行后续更新步骤
if(userBrowsedMap.size()==0)
return;
//用户喜好关键词列表:userPrefListMap:<String(userid),String(json))>
HashMap<Long,CustomizedHashMap<Integer,CustomizedHashMap<String,Double>>> userPrefListMap=RecommendKit.getUserPrefListMap(userBrowsedMap.keySet());
......@@ -62,8 +72,7 @@ public class UserPrefRefresher
//获得对应模块的(关键词:喜好)map
CustomizedHashMap<String,Double> rateMap=userPrefListMap.get(userId).get(moduleId);
//获得新闻的(关键词:TFIDF值)map
@SuppressWarnings("unlikely-arg-type")
List<Keyword> keywordList=(List<Keyword>) newsTFIDFMap.get(news);
List<Keyword> keywordList=(List<Keyword>) newsTFIDFMap.get(news.toString());
Iterator<Keyword> keywordIte=keywordList.iterator();
while(keywordIte.hasNext()){
Keyword keyword=keywordIte.next();
......@@ -83,7 +92,7 @@ public class UserPrefRefresher
Long userId=iterator.next();
try
{
Db.update("update users set upreflist='"+userPrefListMap.get(userId)+"' where userid=?",userId);
Db.update("update users set pref_list='"+userPrefListMap.get(userId)+"' where id=?",userId);
}
catch (Exception e)
{
......@@ -153,14 +162,13 @@ public class UserPrefRefresher
}
/**
* 提取出当天所有用户浏览新闻纪录
* 提取出当天有浏览行为的用户及其各自所浏览过的新闻id列表
* @return
*/
private HashMap<Long,ArrayList<Long>> getBrowsedHistoryMap(){
HashMap<Long, ArrayList<Long>> userBrowsedMap=null;
HashMap<Long, ArrayList<Long>> userBrowsedMap=new HashMap<Long,ArrayList<Long>>();
try
{
userBrowsedMap=new HashMap<Long,ArrayList<Long>>();
List<Newslogs> newslogsList=Newslogs.dao.find("select * from newslogs where view_time>"+RecommendKit.getSpecificDayFormat(0));
for(Newslogs newslogs:newslogsList){
if(userBrowsedMap.containsKey(newslogs.getUserId())){
......@@ -202,28 +210,36 @@ public class UserPrefRefresher
* @return
*/
private HashMap<String,Object> getNewsTFIDFMap(){
HashMap<String,Object> newsTFIDFMap=null;
HashMap<String,Object> newsTFIDFMap=new HashMap<String,Object>();;
try
{
Iterator<Long> ite=getBrowsedNewsSet().iterator();
String newsIdListQuery="(";
while(ite.hasNext()){
newsIdListQuery+=ite.next()+",";
long next=ite.next();
newsIdListQuery+=next+",";
}
//用户如果当天没看新闻
if(newsIdListQuery.length()>1){
newsIdListQuery=newsIdListQuery.substring(0, newsIdListQuery.length()-1)+")";
//提取出所有新闻的关键词列表及对应TF-IDf值,并放入一个map中
List<News> newsList=News.dao.find("select id,title,content,module_id from news where id in "+newsIdListQuery);
newsTFIDFMap=new HashMap<String,Object>();
for(News news:newsList){
newsTFIDFMap.put(String.valueOf(news.getId()), TFIDF.getTFIDE(news.getTitle(), news.getContent(),KEY_WORDS_NUM));
newsTFIDFMap.put(news.getId()+"moduleid", news.getModuleId());
}
// //当天存在用户浏览记录
// if(newsIdListQuery.length()>1){
// newsIdListQuery=newsIdListQuery.substring(0, newsIdListQuery.length()-1)+")";
// //提取出所有新闻的关键词列表及对应TF-IDf值,并放入一个map中
// List<News> newsList=News.dao.find("select id,title,content,module_id from news where id in "+newsIdListQuery);
// System.out.println("newsIdListQuery:"+newsIdListQuery);
// for(News news:newsList){
// newsTFIDFMap.put(String.valueOf(news.getId()), TFIDF.getTFIDE(news.getTitle(), news.getContent(),KEY_WORDS_NUM));
// newsTFIDFMap.put(news.getId()+"moduleid", news.getModuleId());
// }
// for()
// }
newsIdListQuery=newsIdListQuery.substring(0, newsIdListQuery.length()-1)+")";
//提取出所有新闻的关键词列表及对应TF-IDf值,并放入一个map中
List<News> newsList=News.dao.find("select id,title,content,module_id from news where id in "+newsIdListQuery);
for(News news:newsList){
newsTFIDFMap.put(String.valueOf(news.getId()), TFIDF.getTFIDE(news.getTitle(), news.getContent(),KEY_WORDS_NUM));
newsTFIDFMap.put(news.getId()+"moduleid", news.getModuleId());
}
else
return null;
}
catch (Exception e)
{
......
......@@ -46,10 +46,11 @@ public class HotRecommender implements RecommendAlgorithm
{
try
{
//获得已经预备为当前用户推荐的新闻,若数目不足达不到单次的最低推荐数目要求,则用热点新闻补充
Recommendations recommendation=Recommendations.dao.findFirst("select user_id,count(*) as recnums from recommendations where derive_time>'" + timestamp
+ "' and user_id='" + userId + "' group by user_id");
boolean flag=recommendation!=null;
boolean flag=(recommendation!=null);
int delta=flag?TOTAL_REC_NUM - recommendation.getInt("recnums"):TOTAL_REC_NUM;
Set<Long> toBeRecommended = new HashSet<Long>();
......
#Generated by Maven Integration for Eclipse
#Fri Mar 02 17:24:53 CST 2018
#Wed Mar 21 17:07:36 CST 2018
version=0.0.1-SNAPSHOT
groupId=top.tomqian
m2e.projectName=RecommandSystem
m2e.projectLocation=/Users/hanbo/Desktop/NewsRecommendSystem-master
m2e.projectName=TomNewsRecommender
m2e.projectLocation=/Users/hanbo/Desktop/\u8FB9\u57CE/Github/modify_place/NewsRecommendSystem-master
artifactId=recommender-system
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>top.tomqian</groupId>
<artifactId>recommender-system</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.jfinal/jfinal -->
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.ansj/ansj_seg -->
<dependency>
<groupId>org.ansj</groupId>
<artifactId>ansj_seg</artifactId>
<version>5.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mchange/c3p0 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mahout/mahout-core -->
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-core</artifactId>
<version>0.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mahout/mahout-integration -->
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-integration</artifactId>
<version>0.12.2</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.1</version>
</dependency>
</dependencies>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>top.tomqian</groupId>
<artifactId>recommender-system</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.jfinal/jfinal -->
<dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.ansj/ansj_seg -->
<dependency>
<groupId>org.ansj</groupId>
<artifactId>ansj_seg</artifactId>
<version>5.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mchange/c3p0 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mahout/mahout-core -->
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-core</artifactId>
<version>0.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.mahout/mahout-integration -->
<dependency>
<groupId>org.apache.mahout</groupId>
<artifactId>mahout-integration</artifactId>
<version>0.12.2</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.1</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
url = jdbc:mysql://121.42.36.199/tom_recommender?useUnicode=true&characterEncoding=utf8
user = root
password = qxysay1+1=2
\ No newline at end of file
####设置###
#log4j.rootLogger = D,E
#
#### 输出信息到控制台###
#log4j.appender.stdout = org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.Target = logs/info.log
#log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
#log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
#
####输出DEBUG级别日志到/res/logs ###
#log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
#log4j.appender.D.File = logs/debug.log
#log4j.appender.D.Append = true
#log4j.appender.D.Threshold = DEBUG
#log4j.appender.D.layout = org.apache.log4j.PatternLayout
#log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
#
####输出ERROR级别日志到/res/logs/error.log###
#log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
#log4j.appender.E.File =logs/error.log
#log4j.appender.E.Append = true
#log4j.appender.E.Threshold = ERROR
#log4j.appender.E.layout = org.apache.log4j.PatternLayout
#log4j.appender.E.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
\ No newline at end of file
#---Recommend System Parameter---
#Recommendation Executing Moment (Please refer to [Quartz's CronExpression])
startAt=0 0 0 ? * *
#---Specific Algorithm Parameter---
#-RecommendKit-
#Valid specific day the news published after which are still valuable
beforeDays=-30
#Valid specific day after which those who has browsed news can be regarded "active"
activeDay=-30
#-Collaborative Filtering Recommendation-
#Recommend Num from CF(Collaborative Filtering)
CFRecNum=5
#Valid specific day after which users' browsing history would be calculated
CFValidDay=-30
#-Content-Based Recommendation-
#Recommend Num from CB(Content-Based Recommend)
CBRecNum=5
#Set a previous day after which the browsing history will be calculated with, namely, is still in time
previousDays=-30
#TF-IDF's extracting numbers of keywords from every news
TFIDFKeywordsNum=10
#-Hot Recommendation-
文件模式从 100644 更改为 100755
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册