# Tag Info

5

It doesn't matter, it's just what the data is. I assume that you're thinking about issues related to "imbalanced dataset", but this term refers only to imbalance in the values of the target variable (and it's more commonly used about classification, but technically it's relevant also in regression). Features don't need to be balanced in any way, ...

3

Not necessarily, while it can be the case that two observations belong to the same 'group' and end up in the same leaf node (and thus get the same predicted value) there can also be multiple groups of observations that both have the same predicted value. If this is the case in your example is of course dependant on the data you are using. It would indeed be ...

3

The Iris data has three target values ("species"). The objective function in params is set to objective = "binary:logistic", which only accepts two classes (binary taget). In case you have more than two classes, you need a multiclass objective function, e.g. multi:softmax or multi:softprob. As stated in the docs: “binary:logistic” –...

2

As Erwan said, the imbalanced dataset problem is about the target variables and not the features. But if your model favors a section of your regression target more, you can perform a study on the distribution of the target variable and then, depending on the distribution, perform a transformation (e.g. square root or exp), to get a more uniform output. Also, ...

2

Regarding feature encoding As the error says, strings are not accepted. You need to transform item in a way that can be digested by xgboost (essentially some numerical representation). There seems to be a method to transform to categorical when generating the DMatrix (see the docs, never tried it). However, my first idea would be to "one hot" ...

2

XGBoost will not learn "interactions" on its own. Feature generation is often used to enhance the explanatory power of $X$. Often $x_n - x_k$ or $x_n / x_k$ are checked and used. There are also tools for feature generation, e.g. "Featuretools" for Python. One thing you can do to find out what kind of interactions have the most ...

1

With new data, you need to go down exactly the same route as with the data used for training. Something like: # Some data newdf = data.frame(Sepal.Length=c(5.3), Sepal.Width=c(3.2), Petal.Length=c(2.0), Petal.Width=c(0.2)) # Model matrix newdf = model.matrix(~.+0,data = newdf) # Predict on xgb.DMatrix object predict(xgb1,xgb.DMatrix(data = newdf))

1

There isn't much to philosophize here, in order for your model to predict the value for some class, it has to see that class in training. If the model never saw that class it cannot predict it. So you should make sure that all classes are present in your training set. If a new class appears at a later time you have to retrain your model with the new class. ...

Only top voted, non community-wiki answers of a minimum length are eligible