title: How to put more rate to some observations using XGBoost
body: <p>I would like to assign weights to certain observations within the data with XGBoost.
  The feature <code>age_days</code> contains values from 0 to 120. I would like to put more weight to instances that contain values lower than 10 and the rest would be less relevant. I have read about using Dmatrix but I am not entirely sure how that would look like.</p>
  <p>Here is what I currently have:</p>
  <pre><code>
  #age days used as a feature in training dataset
  age_days = 120,120,120,119,119...0
  X_train = filtered_price.drop(['price'], axis=1).values
  y_train = target.values
  train_x, test_x, train_y, test_y = train_test_split(X_train, y_train, test_size=0.2, random_state=7)
  
  
          # Build regression model
  xg_reg = xgb.XGBRegressor(learning_rate=0.01, n_estimators=3460,
                                    max_depth=3, min_child_weight=0,
                                    gamma=0, subsample=0.7,
                                    colsample_bytree=0.7,
                                    objective='reg:squarederror', nthread=4,
                                    scale_pos_weight=1, seed=27,
                                    reg_alpha=0.00006)
  xg_reg.fit(X_train, y_train)
  </code></pre>
  <p>Now I would like to add some weight to the feature that is used in training ['age_days']..</p>
  <pre><code>## weights = if age_days &lt; 10 == 1 else 5..
  </code></pre>
  <p>But I am not sure how to incorporate this with <code>xgb.DMatrix(X_train, y_train, weight = weights) </code></p>