diff --git a/.github/workflows/r_tests.yml b/.github/workflows/r_tests.yml index b3d5ad5b1f03..43ad372a1e84 100644 --- a/.github/workflows/r_tests.yml +++ b/.github/workflows/r_tests.yml @@ -46,8 +46,8 @@ jobs: uses: actions/cache@v4 with: path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-r-${{ matrix.r }}-7-${{ hashFiles('R-package/DESCRIPTION') }} - restore-keys: ${{ runner.os }}-r-${{ matrix.r }}-7-${{ hashFiles('R-package/DESCRIPTION') }} + key: ${{ runner.os }}-r-${{ matrix.r }}-8-${{ hashFiles('R-package/DESCRIPTION') }} + restore-keys: ${{ runner.os }}-r-${{ matrix.r }}-8-${{ hashFiles('R-package/DESCRIPTION') }} - uses: actions/setup-python@v5 with: python-version: "3.10" diff --git a/CMakeLists.txt b/CMakeLists.txt index 0abe69821d14..761aef49d4dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -497,7 +497,8 @@ if(GOOGLE_TEST) configure_file( ${xgboost_SOURCE_DIR}/tests/cli/machine.conf.in ${xgboost_BINARY_DIR}/tests/cli/machine.conf - @ONLY) + @ONLY + NEWLINE_STYLE UNIX) if(BUILD_DEPRECATED_CLI) add_test( NAME TestXGBoostCLI diff --git a/R-package/R/xgb.train.R b/R-package/R/xgb.train.R index 77aa5eb8ccae..49726382c9fb 100644 --- a/R-package/R/xgb.train.R +++ b/R-package/R/xgb.train.R @@ -459,10 +459,10 @@ xgb.train <- function(params = xgb.params(), data, nrounds, evals = list(), #' @param seed Random number seed. If not specified, will take a random seed through R's own RNG engine. #' @param booster (default= `"gbtree"`) #' Which booster to use. Can be `"gbtree"`, `"gblinear"` or `"dart"`; `"gbtree"` and `"dart"` use tree based models while `"gblinear"` uses linear functions. -#' @param eta,learning_rate (two aliases for the same parameter) (default=0.3) +#' @param eta,learning_rate (two aliases for the same parameter) #' Step size shrinkage used in update to prevent overfitting. After each boosting step, we can directly get the weights of new features, and `eta` shrinks the feature weights to make the boosting process more conservative. -#' -#' range: \eqn{[0,1]} +#' - range: \eqn{[0,1]} +#' - default value: 0.3 for tree-based boosters, 0.5 for linear booster. #' #' Note: should only pass one of `eta` or `learning_rate`. Both refer to the same parameter and there's thus no difference between one or the other. #' @param gamma,min_split_loss (two aliases for the same parameter) (for Tree Booster) (default=0, alias: `gamma`) diff --git a/R-package/configure.win b/R-package/configure.win index e69de29bb2d1..3a01292ab6a3 100644 --- a/R-package/configure.win +++ b/R-package/configure.win @@ -0,0 +1,21 @@ +R_EXE="${R_HOME}/bin${R_ARCH_BIN}/R.exe" +CXX=`"${R_EXE}" CMD config CXX` + +cat > test.cpp < +int main() { + char data = 0; + const char* address = &data; + _mm_prefetch(address, _MM_HINT_NTA); + return 0; +} +EOL + +XGBOOST_MM_PREFETCH_PRESENT="" +${CXX} -o test test.cpp 2>/dev/null && ./test && XGBOOST_MM_PREFETCH_PRESENT="-DXGBOOST_MM_PREFETCH_PRESENT=1" +rm -f ./test +rm -f ./test.cpp + +sed \ + -e "s/@XGBOOST_MM_PREFETCH_PRESENT@/$XGBOOST_MM_PREFETCH_PRESENT/" \ + < src/Makevars.win.in > src/Makevars.win diff --git a/R-package/man/xgb.params.Rd b/R-package/man/xgb.params.Rd index e5c74d85f837..f51e764e84db 100644 --- a/R-package/man/xgb.params.Rd +++ b/R-package/man/xgb.params.Rd @@ -121,10 +121,12 @@ contention and hyperthreading in mind.} \item{booster}{(default= \code{"gbtree"}) Which booster to use. Can be \code{"gbtree"}, \code{"gblinear"} or \code{"dart"}; \code{"gbtree"} and \code{"dart"} use tree based models while \code{"gblinear"} uses linear functions.} -\item{eta, learning_rate}{(two aliases for the same parameter) (default=0.3) +\item{eta, learning_rate}{(two aliases for the same parameter) Step size shrinkage used in update to prevent overfitting. After each boosting step, we can directly get the weights of new features, and \code{eta} shrinks the feature weights to make the boosting process more conservative. - -range: \eqn{[0,1]} +\itemize{ +\item range: \eqn{[0,1]} +\item default value: 0.3 for tree-based boosters, 0.5 for linear booster. +} Note: should only pass one of \code{eta} or \code{learning_rate}. Both refer to the same parameter and there's thus no difference between one or the other.} diff --git a/R-package/src/Makevars.win b/R-package/src/Makevars.win.in similarity index 98% rename from R-package/src/Makevars.win rename to R-package/src/Makevars.win.in index 875b3aaca630..8a86ba97c34d 100644 --- a/R-package/src/Makevars.win +++ b/R-package/src/Makevars.win.in @@ -22,6 +22,8 @@ PKG_CPPFLAGS = \ -I$(PKGROOT)/include \ -I$(PKGROOT)/dmlc-core/include \ -I$(PKGROOT) \ + -DXGBOOST_BUILTIN_PREFETCH_PRESENT=1 \ + @XGBOOST_MM_PREFETCH_PRESENT@ \ $(XGB_RFLAGS) PKG_CXXFLAGS = \ diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 4af6b27d6720..1a7fae3d7645 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -2,5 +2,7 @@ function(write_version) message(STATUS "xgboost VERSION: ${xgboost_VERSION}") configure_file( ${xgboost_SOURCE_DIR}/cmake/version_config.h.in - ${xgboost_SOURCE_DIR}/include/xgboost/version_config.h @ONLY) + ${xgboost_SOURCE_DIR}/include/xgboost/version_config.h + @ONLY + NEWLINE_STYLE UNIX) endfunction() diff --git a/doc/parameter.rst b/doc/parameter.rst index 6eddde40910e..d4d8de702a8f 100644 --- a/doc/parameter.rst +++ b/doc/parameter.rst @@ -348,6 +348,11 @@ Parameters for Linear Booster (``booster=gblinear``) - L1 regularization term on weights. Increasing this value will make model more conservative. Normalised to number of training examples. +* ``eta`` [default=0.5, alias: ``learning_rate``] + + - Step size shrinkage used in update to prevent overfitting. After each boosting step, we can directly get the weights of new features, and ``eta`` shrinks the feature weights to make the boosting process more conservative. + - range: [0,1] + * ``updater`` [default= ``shotgun``] - Choice of algorithm to fit linear model diff --git a/doc/tutorials/model.rst b/doc/tutorials/model.rst index 97171fc3c437..d4e04262d214 100644 --- a/doc/tutorials/model.rst +++ b/doc/tutorials/model.rst @@ -146,7 +146,7 @@ It remains to ask: which tree do we want at each step? A natural thing is to ad .. math:: - \text{obj}^{(t)} & = \sum_{i=1}^n l(y_i, \hat{y}_i^{(t)}) + \sum_{i=1}^t\omega(f_i) \\ + \text{obj}^{(t)} & = \sum_{i=1}^n l(y_i, \hat{y}_i^{(t)}) + \sum_{k=1}^t\omega(f_k) \\ & = \sum_{i=1}^n l(y_i, \hat{y}_i^{(t-1)} + f_t(x_i)) + \omega(f_t) + \mathrm{constant} If we consider using mean squared error (MSE) as our loss function, the objective becomes diff --git a/ops/script/test_r_package.py b/ops/script/test_r_package.py index 3ce886c1bc41..ed0d6b1d9faa 100644 --- a/ops/script/test_r_package.py +++ b/ops/script/test_r_package.py @@ -63,7 +63,7 @@ def pkgroot(path: str) -> None: if os.path.exists(osxmakef): os.remove(osxmakef) pkgroot("Makevars.in") - pkgroot("Makevars.win") + pkgroot("Makevars.win.in") # misc rwsp = Path("R-package") / "remove_warning_suppression_pragma.sh" if system() != "Windows":