Colsample_by* params cannot be used together with feature weights

it occurs, that using both colsample_by* params and feature weights causes the next error:

  1. I was trying to find any info in the documentation, and it never mentioned, that those params shouldn’t be used together
  2. is such behavior desired? logically I don’t see the problem with using feature weights with a subsample of the features

Could you please check the feature_weights has the same size of number of features?

In the attached screen first cell shows that shapes are correct.

version: 1.6.1
code to reproduce:

params = {
    'colsample_bytree':0.5, 'colsample_bylevel':0.5, 'colsample_bynode':0.5,
}
X = np.random.rand(1000, 100)
y = np.random.randint(2, size=1000)
weights = np.random.rand(100)
tr = xgb.DMatrix(X, y, feature_weights=weights)
model = xgb.train(params, tr, 10)

The issue occurs for both CPU and GPU and only when 2 or 3 colsample_by* parameters combined

Thank you for sharing! I have reproduced the error. Will open a PR for the fix.

Opened a PR for the fix: https://github.com/dmlc/xgboost/pull/8100