我正在处理一个包含377列和300 000行的数据集,但现在我已经从列和零值列中获取了几乎所有NA值,而且我的sparse_matrix显示的是0 * 176列的维度。它显示没有行为零。
它工作正常,但我删除了一些最不重要的变量,它显示了这个
使用的代码是这个
sparse_matrix <-sparse.model.matrix((Responders)~.-1, data =train)
dim(sparse_matrix)
[1] 0 173
> cxgb1<- xgboost(data = sparse_matrix, label = output_vector, max.depth = 4,
+ eta = 0.8, nthread = 2, nround = 20,objective = "binary:logistic", eval_metric = "auc")
Error in setinfo.xgb.DMatrix(dmat, names(p), p[[1]]) :
The length of labels must equal to the number of rows in the input data
>
正在压制行并将其显示为0
sparse_matrix
0 x 173 sparse Matrix of class "dgCMatrix"
[[ suppressing 173 column names ‘NO_OF_Accs’, ‘HNW_CATEGORY’, ‘vintage’ ... ]]