{"id":19267010,"url":"https://github.com/mljs/xgboost","last_synced_at":"2025-04-21T19:32:34.173Z","repository":{"id":57147066,"uuid":"117311092","full_name":"mljs/xgboost","owner":"mljs","description":"A port of XGBoost to javascript with emscripten","archived":false,"fork":false,"pushed_at":"2018-06-27T00:15:24.000Z","size":9182,"stargazers_count":41,"open_issues_count":7,"forks_count":8,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-31T17:35:00.444Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mljs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-13T03:36:02.000Z","updated_at":"2023-09-25T18:18:17.000Z","dependencies_parsed_at":"2022-09-05T18:01:17.581Z","dependency_job_id":null,"html_url":"https://github.com/mljs/xgboost","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fxgboost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fxgboost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fxgboost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fxgboost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mljs","download_url":"https://codeload.github.com/mljs/xgboost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223876400,"owners_count":17218387,"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-09T20:09:14.916Z","updated_at":"2025-04-21T19:32:34.168Z","avatar_url":"https://github.com/mljs.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xgboost\n\n  [![NPM version][npm-image]][npm-url]\n  [![build status][travis-image]][travis-url]\n  [![David deps][david-image]][david-url]\n  [![npm download][download-image]][download-url]\n\n\n\n## Installation\n\n`$ npm install ml-xgboost`\n\n## [API Documentation](https://mljs.github.io/xgboost/)\n\n## Example\n\n```js\nimport IrisDataset from 'ml-dataset-iris';\n\nrequire('ml-xgboost').then(XGBoost =\u003e {\n    var booster = new XGBoost({\n        booster: 'gbtree',\n        objective: 'multi:softmax',\n        max_depth: 5,\n        eta: 0.1,\n        min_child_weight: 1,\n        subsample: 0.5,\n        colsample_bytree: 1,\n        silent: 1,\n        iterations: 200\n    });\n\n    var trainingSet = IrisDataset.getNumbers();\n    var predictions = IrisDataset.getClasses().map(\n        (elem) =\u003e IrisDataset.getDistinctClasses().indexOf(elem)\n    );\n\n    booster.train(dataset, trueLabels);\n    var predictDataset = /* something to predict */\n    var predictions = booster.predict(predictDataset);\n\n    // don't forget to free your model\n    booster.free()\n\n    // you can save your model in this way\n    var model = JSON.stringify(booster); // string\n    // or\n    var model = booster.toJSON(); // object\n\n    // and load it\n    var anotherBooster = XGBoost.load(model); // model is an object, not a string\n});\n```\n\n## Development\n\n* You should have [emscripten sdk-1.37.22](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html) installed on your computer and be able to use `emcc` and `em++`.\n* Download the repo: `git clone --recursive https://github.com/mljs/xgboost`\n* Run `npm run build` or `make` at the root directory.\n\n## XGBoost library files changed\n\n* dmlc-core/include/dmlc/base.h line 45 [here](./xgboost/dmlc-core/include/dmlc/base.h)\n* rabit/include/dmlc/base.h line 45 [here](./xgboost/rabit/include/dmlc/base.h)\n\n   ```C++\n   #if (!defined(DMLC_LOG_STACK_TRACE) \u0026\u0026 defined(__GNUC__) \u0026\u0026 !defined(__MINGW32__))\n   #define DMLC_LOG_STACK_TRACE 1\n   #undef DMLC_LOG_STACK_TRACE\n   #endif\n   ```\n   **Note**: this is to avoid compilation issues with the execinfo.h library that is not needed in the JS library\n* in case that you get the following error:\n\n    `./xgboost/include/xgboost/c_api.h:29:9: error: unknown type name 'uint64_t'`\n\n    just add this import at the beginning of [this](./xgboost/include/xgboost/c_api.h) file after the first `define`:\n\n    ```C++\n    #include \u003cstdint.h\u003e\n    ```\n\n## License\n\n© Contributors, 2016. Licensed under an [Apache-2](./LICENSE) license.\n\n[npm-image]: https://img.shields.io/npm/v/ml-xgboost.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/ml-xgboost\n[travis-image]: https://img.shields.io/travis/mljs/xgboost/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/mljs/xgboost\n[david-image]: https://img.shields.io/david/mljs/xgboost.svg?style=flat-square\n[david-url]: https://david-dm.org/mljs/xgboost\n[download-image]: https://img.shields.io/npm/dm/ml-xgboost.svg?style=flat-square\n[download-url]: https://www.npmjs.com/package/ml-xgboost\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fxgboost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmljs%2Fxgboost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fxgboost/lists"}