README.md in xgb-0.1.3 vs README.md in xgb-0.2.0

- old
+ new

@@ -1,30 +1,22 @@ -# Xgb +# XGBoost -[XGBoost](https://github.com/dmlc/xgboost) - the high performance machine learning library - for Ruby +[XGBoost](https://github.com/dmlc/xgboost) - high performance gradient boosting - for Ruby -:fire: Uses the C API for blazing performance +[![Build Status](https://travis-ci.org/ankane/xgboost.svg?branch=master)](https://travis-ci.org/ankane/xgboost) -[![Build Status](https://travis-ci.org/ankane/xgb.svg?branch=master)](https://travis-ci.org/ankane/xgb) - ## Installation -First, [install XGBoost](https://xgboost.readthedocs.io/en/latest/build.html). For Homebrew, use: - -```sh -brew install xgboost -``` - Add this line to your application’s Gemfile: ```ruby gem 'xgb' ``` ## Getting Started -This library follows the [Python API](https://xgboost.readthedocs.io/en/latest/python/python_api.html), with the `get_` and `set_` prefixes removed from methods. Some methods and options are missing at the moment. PRs welcome! +This library follows the [Python API](https://xgboost.readthedocs.io/en/latest/python/python_api.html), with the `get_` and `set_` prefixes removed from methods to make it more Ruby-like. ## Learning API Prep your data @@ -35,18 +27,18 @@ Train a model ```ruby params = {objective: "reg:squarederror"} -dtrain = Xgb::DMatrix.new(x, label: y) -booster = Xgb.train(params, dtrain) +dtrain = XGBoost::DMatrix.new(x, label: y) +booster = XGBoost.train(params, dtrain) ``` Predict ```ruby -dtest = Xgb::DMatrix.new(x) +dtest = XGBoost::DMatrix.new(x) booster.predict(dtest) ``` Save the model to a file @@ -55,11 +47,11 @@ ``` Load the model from a file ```ruby -booster = Xgb::Booster.new(model_file: "my.model") +booster = XGBoost::Booster.new(model_file: "my.model") ``` Get the importance of features ```ruby @@ -67,19 +59,26 @@ ``` Early stopping ```ruby -Xgb.train(params, dtrain, evals: [[dtrain, "train"], [dtest, "eval"]], early_stopping_rounds: 5) +XGBoost.train(params, dtrain, evals: [[dtrain, "train"], [dtest, "eval"]], early_stopping_rounds: 5) ``` CV ```ruby -Xgb.cv(params, dtrain, nfold: 3, verbose_eval: true) +XGBoost.cv(params, dtrain, nfold: 3, verbose_eval: true) ``` +Set metadata about a model [master] + +```ruby +booster["key"] = "value" +booster.attributes +``` + ## Scikit-Learn API Prep your data ```ruby @@ -88,15 +87,15 @@ ``` Train a model ```ruby -model = Xgb::Regressor.new +model = XGBoost::Regressor.new model.fit(x, y) ``` -> For classification, use `Xgb::Classifier` +> For classification, use `XGBoost::Classifier` Predict ```ruby model.predict(x) @@ -146,28 +145,10 @@ ```ruby Numo::DFloat.new(3, 2).seq ``` -## XGBoost Installation - -There’s an experimental branch that includes XGBoost with the gem for easiest installation. - -```ruby -gem 'xgb', github: 'ankane/xgb', branch: 'vendor', submodules: true -``` - -Please file an issue if it doesn’t work for you. - -You can also specify the path to XGBoost in an initializer: - -```ruby -Xgb.ffi_lib << "/path/to/xgboost/lib/libxgboost.so" -``` - -> Use `libxgboost.dylib` for Mac and `xgboost.dll` for Windows - ## Helpful Resources - [Parameters](https://xgboost.readthedocs.io/en/latest/parameter.html) - [Parameter Tuning](https://xgboost.readthedocs.io/en/latest/tutorials/param_tuning.html) @@ -180,15 +161,24 @@ Thanks to the [xgboost](https://github.com/PairOnAir/xgboost-ruby) gem for serving as an initial reference. ## History -View the [changelog](https://github.com/ankane/xgb/blob/master/CHANGELOG.md) +View the [changelog](https://github.com/ankane/xgboost/blob/master/CHANGELOG.md) ## Contributing Everyone is encouraged to help improve this project. Here are a few ways you can help: -- [Report bugs](https://github.com/ankane/xgb/issues) -- Fix bugs and [submit pull requests](https://github.com/ankane/xgb/pulls) +- [Report bugs](https://github.com/ankane/xgboost/issues) +- Fix bugs and [submit pull requests](https://github.com/ankane/xgboost/pulls) - Write, clarify, or fix documentation - Suggest or add new features + +To get started with development and testing: + +```sh +git clone https://github.com/ankane/xgboost.git +cd xgboost +bundle install +bundle exec rake test +```