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)
- clarification needed for model/saving loading HOT 2
- Missing XGBoostRanker in xgboost4j-spark jvm package HOT 3
- multi label support in Scala xgboost. HOT 8
- SparkXGBClassifier does not validate params HOT 6
- feature_weights only compatible with CPU ? HOT 1
- Improve XGBoost quantile predictions HOT 3
- Latest version training crashes HOT 12
- Error when trying to build HOT 4
- Model provides different results for different Python versions HOT 2
- 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
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.