Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] Reference the R doc in sphinx document site. #11166

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,25 @@ jobs:
- runs-on=${{ github.run_id }}
- runner=linux-amd64-cpu
- tag=doc-build-jvm-docs

steps:
# Restart Docker daemon so that it recognizes the ephemeral disks
- run: sudo systemctl restart docker
- uses: actions/checkout@v4
with:
submodules: "true"

- name: Get the git hash for the push event.
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
echo "HEAD_SHA=${GITHUB_SHA}" >> ${GITHUB_ENV}
- name: Get the git hash for the PR event.
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> ${GITHUB_ENV}
- name: Log into Docker registry (AWS ECR)
run: bash ops/pipeline/login-docker-registry.sh
- run: bash ops/pipeline/build-jvm-gpu.sh
Expand All @@ -29,9 +42,43 @@ jobs:
# branch can be the name of the dmlc/xgboost branch, or `PR-{number}`.
python3 ops/pipeline/manage-artifacts.py upload \
--s3-bucket xgboost-docs \
--prefix ${BRANCH_NAME}/${GITHUB_SHA} --make-public \
--prefix ${BRANCH_NAME}/${{ env.HEAD_SHA }} --make-public \
jvm-packages/${{ env.BRANCH_NAME }}.tar.bz2
build-r-docs:
name: Build docs for the R package
runs-on:
- runs-on=${{ github.run_id }}
- runner=linux-amd64-cpu
- tag=r-tests-build-docs
steps:
# Restart Docker daemon so that it recognizes the ephemeral disks
- run: sudo systemctl restart docker
- uses: actions/checkout@v4
with:
submodules: "true"

- name: Get the git hash for the push event.
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
echo "HEAD_SHA=${GITHUB_SHA}" >> ${GITHUB_ENV}
- name: Get the git hash for the PR event.
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> ${GITHUB_ENV}
- name: Log into Docker registry (AWS ECR)
run: bash ops/pipeline/login-docker-registry.sh
- run: bash ops/pipeline/build-r-docs.sh
- name: Upload R doc
run: |
python3 ops/pipeline/manage-artifacts.py upload \
--s3-bucket xgboost-docs \
--prefix ${BRANCH_NAME}/${{ env.HEAD_SHA }} --make-public \
r-docs-${{ env.BRANCH_NAME }}.tar.bz2
trigger-rtd-build:
needs: [build-jvm-docs]
name: Trigger Read The Docs build.
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/jvm_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,36 +95,6 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_IAM_S3_UPLOADER }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_IAM_S3_UPLOADER }}

build-jvm-docs:
name: Build docs for JVM packages
needs: [build-jvm-gpu]
runs-on:
- runs-on=${{ github.run_id }}
- runner=linux-amd64-cpu
- tag=jvm-tests-build-jvm-docs
steps:
# Restart Docker daemon so that it recognizes the ephemeral disks
- run: sudo systemctl restart docker
- uses: actions/checkout@v4
with:
submodules: "true"
- name: Log into Docker registry (AWS ECR)
run: bash ops/pipeline/login-docker-registry.sh
- name: Unstash files
run: |
python3 ops/pipeline/manage-artifacts.py download \
--s3-bucket ${{ env.RUNS_ON_S3_BUCKET_CACHE }} \
--prefix cache/${{ github.run_id }}/build-jvm-gpu \
--dest-dir lib \
libxgboost4j.so
- run: bash ops/pipeline/build-jvm-doc.sh
- name: Upload JVM doc
run: |
python3 ops/pipeline/manage-artifacts.py upload \
--s3-bucket xgboost-docs \
--prefix ${BRANCH_NAME}/${GITHUB_SHA} --make-public \
jvm-packages/${{ env.BRANCH_NAME }}.tar.bz2
build-test-jvm-packages:
name: Build and test JVM packages (Linux, Scala ${{ matrix.scala_version }})
runs-on:
Expand Down
3 changes: 3 additions & 0 deletions R-package/.Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
README.md
^doc$
^Meta$
^_pkgdown\.yml$
^docs$
^pkgdown$
1 change: 1 addition & 0 deletions R-package/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs
16 changes: 5 additions & 11 deletions R-package/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
XGBoost R Package for Scalable GBM
==================================
XGBoost R Package
=================

[![CRAN Status Badge](http://www.r-pkg.org/badges/version/xgboost)](https://cran.r-project.org/web/packages/xgboost)
[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/xgboost)](https://cran.rstudio.com/web/packages/xgboost/index.html)
[![Documentation Status](https://readthedocs.org/projects/xgboost/badge/?version=latest)](http://xgboost.readthedocs.org/en/latest/R-package/index.html)
[![Documentation Status](https://readthedocs.org/projects/xgboost/badge/?version=latest)](https://xgboost.readthedocs.org/en/latest/R-package/index.html)

Resources
---------
* [XGBoost R Package Online Documentation](http://xgboost.readthedocs.org/en/latest/R-package/index.html)
* [XGBoost R Package Online Documentation](https://xgboost.readthedocs.org/en/stable/R-package/index.html)
- Check this out for detailed documents, examples and tutorials.

Installation
Expand All @@ -19,13 +19,7 @@ We are [on CRAN](https://cran.r-project.org/web/packages/xgboost/index.html) now
install.packages('xgboost')
```

For more detailed installation instructions, please see [here](http://xgboost.readthedocs.org/en/latest/build.html#r-package-installation).

Examples
--------

* Please visit [walk through example](demo).
* See also the [example scripts](../demo/kaggle-higgs) for Kaggle Higgs Challenge, including [speedtest script](../demo/kaggle-higgs/speedtest.R) on this dataset and the one related to [Otto challenge](../demo/kaggle-otto), including a [RMarkdown documentation](../demo/kaggle-otto/understandingXGBoostModel.Rmd).
For more detailed installation instructions, please see [here](https://xgboost.readthedocs.io/en/stable/install.html).

Development
-----------
Expand Down
92 changes: 92 additions & 0 deletions R-package/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
url: https://github.com/dmlc/xgboost

template:
bootstrap: 5
math-rendering: mathjax
trivialfis marked this conversation as resolved.
Show resolved Hide resolved

reference:
trivialfis marked this conversation as resolved.
Show resolved Hide resolved
- title: High Level Interface
desc: High level XGBoost interface
contents:
- "xgboost"
- "predict.xgboost"
- "print.xgboost"
- title: Datasets
desc: Test datasets bundled with the R package.
contents:
- "agaricus.train"
- "agaricus.test"
- title: Global Configuration
desc: Global configuration for the XGBoost library.
contents:
- "xgb.config"
- "xgb.set.config"
- "xgb.get.config"
- title: DMatrix
desc: Low-level data storage.
contents:
- "xgb.DMatrix"
- "xgb.DMatrix.hasinfo"
- "xgb.DMatrix.save"
- "dim.xgb.DMatrix"
- "dimnames.xgb.DMatrix"
- "print.xgb.DMatrix"
- "xgb.DataBatch"
- "xgb.DataIter"
- "xgb.get.DMatrix.data"
- "xgb.get.DMatrix.num.non.missing"
- "xgb.ExtMemDMatrix"
- "xgb.QuantileDMatrix.from_iterator"
- "xgb.get.DMatrix.qcut"
- "xgb.slice.DMatrix"
- title: Booster
desc: The model for XGBoost.
contents:
- "a-compatibility-note-for-saveRDS-save"
- "coef.xgb.Booster"
- "getinfo.xgb.Booster"
- "predict.xgb.Booster"
- "print.xgb.Booster"
- "xgb.load"
- "xgb.load.raw"
- "xgb.save"
- "xgb.save.raw"
- "xgb.copy.Booster"
- "xgb.slice.Booster"
- "xgb.get.num.boosted.rounds"
- "xgb.is.same.Booster"
- "xgb.importance"
- "xgb.attr"
- "xgb.create.features"
- "xgb.model.dt.tree"
- "xgb.model.parameters<-"
- "xgb.ggplot.deepness"
- "xgb.dump"
- "variable.names.xgb.Booster"
- "xgb.ggplot.importance"
- "xgb.plot.multi.trees"
- "xgb.plot.shap"
- "xgb.ggplot.shap.summary"
- "xgb.plot.tree"
- "xgb.gblinear.history"
- title: Training Callbacks
desc: Callback functions used for training.
contents:
- "xgb.Callback"
- "xgb.cb.cv.predict"
- "xgb.cb.early.stop"
- "xgb.cb.evaluation.log"
- "xgb.cb.gblinear.history"
- "xgb.cb.print.evaluation"
- "xgb.cb.reset.parameters"
- "xgb.cb.save.model"
- title: Low-level Training Functions
desc: Low-level Training Functions with DMatrix and Booster
contents:
- "xgb.params"
- "xgb.train"
- "xgb.cv"
- "print.xgb.cv.synchronous"
trivialfis marked this conversation as resolved.
Show resolved Hide resolved
- title: Deprecation Settings
contents:
- "xgboost-options"
1 change: 0 additions & 1 deletion R-package/tests/helper_scripts/install_deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pkgs <- c(
"RhpcBLASctl",
## imports
"Matrix",
"methods",
"data.table",
"jsonlite"
)
Expand Down
15 changes: 9 additions & 6 deletions R-package/vignettes/xgboost_introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ output:
toc_float: true
---

# Introduction
XGBoost for R introduction
==========================

## Introduction

**XGBoost** is an optimized distributed gradient boosting library designed to be highly **efficient**, **flexible** and **portable**. It implements machine learning algorithms under the [Gradient Boosting](https://en.wikipedia.org/wiki/Gradient_boosting) framework. XGBoost provides a parallel tree boosting (also known as GBDT, GBM) that solve many data science problems in a fast and accurate way. The same code runs on major distributed environment (Hadoop, SGE, MPI) and can solve problems beyond billions of examples.

Expand All @@ -22,7 +25,7 @@ For more details about XGBoost's features and usage, see the [online documentati

This short vignette outlines the basic usage of the R interface for XGBoost, assuming the reader has some familiarity with the underlying concepts behind statistical modeling with gradient-boosted decision trees.

# Building a predictive model
## Building a predictive model

At its core, XGBoost consists of a C++ library which offers bindings for different programming languages, including R. The R package for XGBoost provides an idiomatic interface similar to those of other statistical modeling packages using and x/y design, as well as a lower-level interface that interacts more directly with the underlying core library and which is similar to those of other language bindings like Python, plus various helpers to interact with its model objects such as by plotting their feature importances or converting them to other formats.

Expand Down Expand Up @@ -62,7 +65,7 @@ model_abserr <- xgboost(x, y, objective = "reg:absoluteerror", nthreads = 1, nro

_Note: the objective must match with the type of the "y" response variable - for example, classification objectives for discrete choices require "factor" types, while regression models for real-valued data require "numeric" types._

# Model parameters
## Model parameters

XGBoost models allow a large degree of control over how they are built. By their nature, gradient-boosted decision tree ensembles are able to capture very complex patterns between features in the data and a response variable, which also means they can suffer from overfitting if not controlled appropirately.

Expand Down Expand Up @@ -105,7 +108,7 @@ xgboost(
)
```

# Examining model objects
## Examining model objects

XGBoost model objects for the most part consist of a pointer to a C++ object where most of the information is held and which is interfaced through the utility functions and methods in the package, but also contains some R attributes that can be retrieved (and new ones added) through `attributes()`:

Expand All @@ -131,7 +134,7 @@ xgb.importance(model)
xgb.model.dt.tree(model)
```

# Other features
## Other features

XGBoost supports many additional features on top of its traditional gradient-boosting framework, including, among others:

Expand All @@ -143,7 +146,7 @@ XGBoost supports many additional features on top of its traditional gradient-boo

See the [online documentation](https://xgboost.readthedocs.io/en/stable/index.html) - particularly the [tutorials section](https://xgboost.readthedocs.io/en/stable/tutorials/index.html) - for a glimpse over further functionalities that XGBoost offers.

# The low-level interface
## The low-level interface

In addition to the `xgboost(x, y, ...)` function, XGBoost also provides a lower-level interface for creating model objects through the function `xgb.train()`, which resembles the same `xgb.train` functions in other language bindings of XGBoost.

Expand Down
1 change: 1 addition & 0 deletions doc/R-package/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*~
*.md
2 changes: 2 additions & 0 deletions doc/R-package/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ PKGROOT=../../R-package
xgboostfromJSON.md: $(PKGROOT)/vignettes/xgboostfromJSON.Rmd
xgboost_introduction.md: $(PKGROOT)/vignettes/xgboost_introduction.Rmd

all: xgboostfromJSON.md xgboost_introduction.md

# General Rules for build rmarkdowns, need knitr
%.md:
trivialfis marked this conversation as resolved.
Show resolved Hide resolved
Rscript -e \
Expand Down
19 changes: 16 additions & 3 deletions doc/R-package/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,32 @@ XGBoost R Package

You have found the XGBoost R Package!

.. toctree::
:maxdepth: 2
:titlesonly:

***********
Get Started
***********

* Checkout the :doc:`Installation Guide </install>` contains instructions to install xgboost, and :doc:`Tutorials </tutorials/index>` for examples on how to use XGBoost for various tasks.
* Read the `API documentation <https://cran.r-project.org/web/packages/xgboost/xgboost.pdf>`_.
* Read the latest `API documentation <../r_docs/R-package/docs/reference/index.html>`__ . This might refer to a newer version than the one on CRAN.
* Read the `CRAN documentation <https://cran.r-project.org/web/packages/xgboost/xgboost.pdf>`_.

*********
Vignettes
trivialfis marked this conversation as resolved.
Show resolved Hide resolved
*********

.. toctree::

xgboost_introduction
xgboostfromJSON

************
Other topics
************

.. toctree::
:maxdepth: 2
:titlesonly:

Migrating code from previous XGBoost versions <migration_guide>
Handling of indexable elements <index_base>
Expand Down
5 changes: 5 additions & 0 deletions doc/R-package/r_docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:orphan:

=============
XGBoost R API
=============
Loading
Loading