{"id":20977492,"url":"https://github.com/yasserg/jforests","last_synced_at":"2025-05-14T14:32:21.128Z","repository":{"id":28593095,"uuid":"32111306","full_name":"yasserg/jforests","owner":"yasserg","description":"Automatically exported from code.google.com/p/jforests","archived":false,"fork":false,"pushed_at":"2020-10-12T19:24:00.000Z","size":26227,"stargazers_count":65,"open_issues_count":8,"forks_count":29,"subscribers_count":6,"default_branch":"master","last_synced_at":"2023-03-17T13:00:59.945Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yasserg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-13T00:30:19.000Z","updated_at":"2022-01-12T07:44:45.000Z","dependencies_parsed_at":"2022-09-03T17:31:12.171Z","dependency_job_id":null,"html_url":"https://github.com/yasserg/jforests","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasserg%2Fjforests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasserg%2Fjforests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasserg%2Fjforests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yasserg%2Fjforests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yasserg","download_url":"https://codeload.github.com/yasserg/jforests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225297832,"owners_count":17452010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T04:59:09.169Z","updated_at":"2024-11-19T04:59:09.721Z","avatar_url":"https://github.com/yasserg.png","language":"Java","funding_links":[],"categories":["人工智能"],"sub_categories":["机器学习"],"readme":"jforests is a Java library that implements many tree-based learning algorithms.\n\njforests can be used for regression, classification and ranking problems. The latest release can be downloaded from  https://github.com/yasserg/jforests/releases\n\nThe following tutorial shows how jforests can be used for learning a ranking model using the LambdaMART algorithm.\n\n# Learning to Rank with LambdaMART\n\n## Data Sets Format\njforests uses the following format for its input data sets (same as the one used in SVMLight):\n\n```\n\u003cline\u003e .=. \u003crelevance\u003e qid:\u003cqid\u003e \u003cfeature\u003e:\u003cvalue\u003e ... \u003cfeature\u003e:\u003cvalue\u003e \n\u003crelevance\u003e .=. \u003cinteger\u003e\n\u003cqid\u003e .=. \u003cpositive integer\u003e\n\u003cfeature\u003e .=. \u003cpositive integer\u003e\n\u003cvalue\u003e .=. \u003cfloat\u003e\n```\n\nFor this tutorial, we will use the sample data set which is available [here](jforests/src/main/resources/sample-ranking-data.zip).\n\n\n## Converting Data Sets to Binary Format\nIn order to speed up the computations, jforests converts its input data sets to binary format. We are assuming that you have unzipped the above sample data set in a folder and are currently on that folder. You should have also [downloaded](https://github.com/yasserg/jforests/releases) the latest jforests jar file and renamed it to 'jforests.jar' and put it in the same folder.\n\nThe following command can be used for converting data sets to binary format:\n\n```shell script\njava -jar jforests.jar --cmd=generate-bin --ranking --folder . --file train.txt --file valid.txt --file test.txt\n```\n\nAs this command shows, we are converting 'train.txt', 'valid.txt', and 'test.txt' to binary format. As a result 'train.bin', 'valid.bin', and 'test.bin' are generated.\n\n## Learning the Ranking Model\nOnce the input data sets are converted to the binary format, a ranking model can be trained on them.\n\nFirst you need to specify the parameters of your machine learning algorithm. The following is a sample set of parameters for the LambdaMART algorithm:\n\n```properties\ntrees.num-leaves=7\ntrees.min-instance-percentage-per-leaf=0.25\nboosting.learning-rate=0.05\nboosting.sub-sampling=0.3\ntrees.feature-sampling=0.3\n\nboosting.num-trees=2000\nlearning.algorithm=LambdaMART-RegressionTree\nlearning.evaluation-metric=NDCG\n\nparams.print-intermediate-valid-measurements=true\n```\n\nCreate a 'ranking.properties' file in the current folder and save the above config in it.\n\nThen the following command can be used for training a LambdaMART ensemble and storing it in the 'ensemble.txt' file:\n\n```shell script\njava -jar jforests.jar --cmd=train --ranking --config-file ranking.properties --train-file train.bin --validation-file valid.bin --output-model ensemble.txt\n```\n\n## Predicting Scores of Documents\nOnce you have the LambdaMART ensemble, you can use it for predicting scores of test documents. The following command performs this step and stores the results in the 'predcitions.txt' file.\n\n```shell script\njava -jar jforests.jar --cmd=predict --ranking --model-file ensemble.txt --tree-type RegressionTree --test-file test.bin --output-file predictions.txt\n```\n\nScores can then be used for measuring NDCG or other information retrieval measures.\n\n## Advanced Ranking Options\n\nJforests can be configured to change the used measure for LambdaMART using the `learning.evaluation-metric` entry in the `ranking.properties` file. Currently, NDCG is supported, as well as risk-sensitive evaluation measures such as URisk and TRisk - see [RiskSensitiveLambdaMART](RiskSensitiveLambdaMART.md).\n\n# Source Code\nSource code is are available from the Github  repository: https://github.com/yasserg/jforests\n\n# Citation Policy\nIf you use jforests for a research purpose, please use the following citation:\n\nY. Ganjisaffar, R. Caruana, C. Lopes, *Bagging Gradient-Boosted Trees for High Precision, Low Variance Ranking Models*, in SIGIR 2011, Beijing, China.\n\n## BibTeX:\n```bibtex\n@inproceedings{Ganji:2011:SIGIR,\n\tauthor = {Yasser Ganjisaffar and Rich Caruana and Cristina Lopes},\n\ttitle = {Bagging Gradient-Boosted Trees for High Precision, Low Variance Ranking Models},\n\tbooktitle = {Proceedings of the 34th international ACM SIGIR conference on Research and development in Information},\n\tseries = {SIGIR '11},\n\tyear = {2011},\n\tisbn = {978-1-4503-0757-4},\n\tlocation = {Beijing, China},\n\tpages = {85--94},\n\tnumpages = {10},\n\tdoi = {http://doi.acm.org/10.1145/2009916.2009932},\n\tacmid = {2009932},\n\tpublisher = {ACM},\n\taddress = {New York, NY, USA},\n}\n```\n\nIf you use risk-sensitive learning to rank, please see [RiskSensitiveLambdaMART](RiskSensitiveLambdaMART.md) for citation information.\n\n## License\n\nCopyright (c) 2011-2015 Yasser Ganjisaffar\n\nPublished under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasserg%2Fjforests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyasserg%2Fjforests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyasserg%2Fjforests/lists"}