README.md in lightgbm-0.1.1 vs README.md in lightgbm-0.1.2

- old
+ new

@@ -14,10 +14,12 @@ ```ruby gem 'lightgbm' ``` +## Getting Started + Train a model ```ruby params = {objective: "regression"} train_set = LightGBM::Dataset.new(x_train, label: y_train) @@ -28,17 +30,17 @@ ```ruby booster.predict(x_test) ``` -Save the model +Save the model to a file ```ruby booster.save_model("model.txt") ``` -Load a model from a file +Load the model from a file ```ruby booster = LightGBM::Booster.new(model_file: "model.txt") ``` @@ -46,32 +48,34 @@ ```ruby booster.feature_importance ``` -## Reference +## Early Stopping -### Booster - ```ruby -booster = LightGBM::Booster.new(model_str: "tree...") -booster.to_json -booster.model_to_string -booster.current_iteration +LightGBM.train(params, train_set, valid_set: [train_set, test_set], early_stopping_rounds: 5) ``` -### Dataset +## CV ```ruby -dataset = LightGBM::Dataset.new(data, label: label, weight: weight, params: params) -dataset.num_data -dataset.num_feature - -# note: only works with unquoted CSVs -dataset = LightGBM::Dataset.new("data.csv", params: {headers: true, label: "name:label"}) -dataset.save_binary("train.bin") -dataset.dump_text("train.txt") +LightGBM.cv(params, train_set, nfold: 5, verbose_eval: true) ``` + +## Reference + +This library follows the [Data Structure and Training APIs](https://lightgbm.readthedocs.io/en/latest/Python-API.html) for the Python library. A few differences are: + +- The default verbosity is `-1` +- With the `cv` method, `stratified` is set to `false` + +Some methods and options are also missing at the moment. PRs welcome! + +## Helpful Resources + +- [Parameters](https://lightgbm.readthedocs.io/en/latest/Parameters.html) +- [Parameter Tuning](https://lightgbm.readthedocs.io/en/latest/Parameters-Tuning.html) ## Credits Thanks to the [xgboost](https://github.com/PairOnAir/xgboost-ruby) gem for serving as an initial reference, and Selva Prabhakaran for the [test datasets](https://github.com/selva86/datasets).