java using用法_推荐系统使用JAVA&LibRec

Generic Interfaces, Data Structures and Recommendation Algorithms.

1.png

Here are some useful resources for LibRec:

LibRec Examples on Real Data Sets & comparison with other recommendation libraries

Downloading and Running LibRec

1. Download the latest release zip file and unzip it to a local directory.

2. Run command or terminal and use “cd” to locate the library directory.

3. Extract librec.jar library

4. Run the LibRec library by: java -jar librec.jar

After you extract the librec.jar file, you can see librec.conf file in your directory. This configuration file contains all the necessary settings about which dataset to use, what evaluation measure to use, etc. It also contains the path to output evaluation result. However, when you run java -jar librec.jar, you can also see the result in your terminal.

Output results = evaluation measurements followed by the recommender options and execution time.

Rating prediction: MAE, RMSE, NMAE, rMAE, rRMSE, MPE

Item recommendation: Precision@5, Precision@10, Recall@5, Recall@10, AUC, MAP, NDCG, MRR

By default, LibRec uses FilmTrust’s ratings dataset. You can use your own dataset (CSV format, txt format, etc.) as well. For that, you just need to edit the dataset path in librec.config file.

You can also use your own custom config file instead of using the default librec.config. To use your custom config file, you can modify the command as below:

java -jar librec.jar -c configFile1.conf [configFile2.conf …]

LibRec also provides some demo config files (like UserKNN.config, ItemKNN.config, SVD++.config, etc.) that can be used to implement some particular recommendation algorithms. These demo configs are present inside your “librec-folder/demo/config” directory.

Here’s how UserKNN.config looks like. The evaluation result output is displayed in the terminal and also saved in “librec-folder/demo/Results” directory.

dataset.ratings.wins=.\\demo\\Datasets\\FilmTrust\\ratings.txt

dataset.ratings.lins=./demo/Datasets/FilmTrust/ratings.txt

ratings.setup=-columns 0 1 2 -threshold -1

recommender=UserKNN

evaluation.setup=cv -k 5 -p on –rand-seed 1 –test-view all

item.ranking=off -topN -1 -ignore -1

similarity=PCC

num.shrinkage=30

num.neighbors=50

output.setup=on -dir ./demo/Results/

ItemKNN.config

dataset.ratings.wins=.\\demo\\Datasets\\FilmTrust\\ratings.txt

dataset.ratings.lins=./demo/Datasets/FilmTrust/ratings.txt

ratings.setup=-columns 0 1 2 -threshold -1

recommender=ItemKNN

evaluation.setup=cv -k 5 -p on –rand-seed 1 –test-view all

item.ranking=off -topN -1 -ignore -1

similarity=PCC

num.shrinkage=30

num.neighbors=50

output.setup=on -dir ./demo/Results/

Hope this helps.

Thanks.

Share this:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值