Comments (2)
currently, it is not possible, however, you are allowed to start from big DMatrix and slice it.
from xgboost.
Because you make reference to cbind I imagine you use R. If yes, you can use cbind2 to join two sparse Matrix. It works very well. Don't forget to remove the intercept column before joining (with a formulae like ~.-1).
One use case for me is a dataset very big that I need to hot encode. Because two version of the dataset don't fit in the RAM I hot encod one column a time then merge it in a final matrix, delete the column in the dense matrix and do it again until all column are converted.
It works. It's slow (15mn for 4Gb on a recent laptop).
convertToSparseMatrix <- function(dataset, delDataset = T, verbose = F){
cols <- colnames(dataset) %>% copy
for(col in cols){
if(verbose) print(col)
f <- col %>% paste("~", ., "-1", sep = "", collapse = "") %>% as.formula
if(exists("X")){
X1 <- sparse.model.matrix(f, data = dataset)
X <- cbind2(X, X1)
rm(X1)
} else {
X <- sparse.model.matrix(f, data = dataset)
}
if(delDataset) dataset[,col:=NULL, with=F]
}
X
}
@tqchen are you interested in this method for R package?
Kind regards,
Michaël
from xgboost.
Related Issues (20)
- 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
- 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
- [CI] Retire Mac Mini worker in BuildKite
- [RFC] New logo for XGBoost HOT 1
- c-ares and BoringSSL version in xgboost 2.0.3 HOT 6
- Federated horizontal result does not align with basic training without federation
- monotone_constraints not working with xgb.regressor (python)
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.