Comments (4)
Additionally:
- If the end of the slice (which is not included in the output) goes past the number of rounds in the model, regardless of what's the last number that the sequence would involve, it will throw an out-of-bounds error.
Here it has 20 rounds, but cannot slice like this:
import numpy as np, xgboost as xgb
rng = np.random.default_rng(seed=123)
y = rng.standard_normal(size=100)
X = rng.standard_normal(size=(100,10))
dm = xgb.DMatrix(X, y)
model = xgb.train(
dtrain=dm,
params={},
num_boost_round=20
)
model[0:21:3]
Note that this slice would stop at 18, which is within the range of the model's rounds:
np.arange(20)[0:21:3]
array([ 0, 3, 6, 9, 12, 15, 18])
- When the underlying C function
XGBoosterSlice
returns code -2 (index out of bound), it will not set a message inXGBGetLastError()
. The case above has an error message, but that error is thrown from the python wrapper, not from C++.
from xgboost.
The slicing is not as rich as Python or numpy. We at the time thought this might be a bit over-engineering for a booster class. It seems we should implement the full slicing just for less confusion. The easiest way to do it is just to convert a booster into a list of boosters and then let Python do the rest of the indexing. However, the conversion can be expensive.
from xgboost.
The slicing is not as rich as Python or numpy. We at the time thought this might be a bit over-engineering for a booster class. It seems we should implement the full slicing just for less confusion. The easiest way to do it is just to convert a booster into a list of boosters and then let Python do the rest of the indexing. However, the conversion can be expensive.
I don't think that'd be necessary, since it's possible to e.g. create a sequence with np.arange
, slice it using the user' input, and pass those integers as an array instead.
Or, since this functionality is only used in the early stopping callback, could also be possible to remove the 'step' part altogether.
from xgboost.
It's used inside xgboost for early stopping, but outside of xgboost, it's also used for people to explore the individual trees' impact on the final output. There are some quirks in gradient boosting, like the first few trees are usually shallower than the latter trees, sometimes people customize their models for exploratory purposes, sometimes used for extracting a submodel then stacking with other models.
from xgboost.
Related Issues (20)
- error in the docs for ranking HOT 1
- Defining a callback to write hessians of train observations to a csv file HOT 2
- Slow inference on sphoradic stremaing data HOT 2
- XGBoost GPU Warning When Working with BayesSearchCV (XGBoost is running on: cuda:0, while the input data is on: cpu.)
- help installing xgboost with gpu HOT 2
- Potential Documentation Inaccuracy Regarding Feature Interaction Constraints
- Horizontal Federated Learning with Secure Features RFC
- [bug] Python - Cuda error (without using Cuda) HOT 5
- Pandas 2.2: Index.format is deprecated
- ArrayInterface handler for cuDF DataFrame cannot yet handle Boolean columns HOT 1
- src/metric/auc.cc:322: Check failed: auc <= local_area HOT 1
- XGBoost4j-spark CrossValidation train FAILED on multi-GPU environment: : Multiple processes running on same CUDA device is not supported! HOT 1
- [jvm-packages] Scaladoc is not working in latest XGBoost
- [CI] Tracker for improving build and CI/CD infrastructure
- [CI] Set up a nightly pipeline to test with dev versions of RAPIDS
- xgboost predict takes a long time HOT 1
- xgboost4j_2.12:1.7.6 's (ml/dmlc/xgboost4j/java/XGBoostJNI.XGBoosterPredict) much slower than 0.90 in some model HOT 6
- NumPy 2.0 support HOT 2
- Tutorial on c-api distributed training of xgboost HOT 2
- Python 3.12 `xgboost.core.XGBoostError: Invalid Parameter format for nthread expect int but value='-1'` when `DMatrix` used with `import googlecloudprofiler`. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xgboost.