Is there a way to take a set of data that consists of discrete values and predict a continuous value? Take for instance data that looks like:

sample matrix of jewel data
 color |  size | shape 
['red' ,'large','square']

sample array of price labels
[9.99, 7.00, 6.37]

Can I do Decision Tree Regression on this to predict the price of a jewel with a given set of features? What if some of the data is continuous? Also is there any way I can/should pre-process the categorical data other than onehot encoding?


1 Answer 1


Yes, most software implementations of trees will allow you to predict a continuous target variable with all binary predictors. This is because the predictors are only used as splits, and the prediction comes from the average value at a given terminal node. The predictions will not be truly continuous across all terminal nodes in the same way that linear regression is continuous, but in practice, this is generally not a problem. If your tree is under-fitting (not continuous enough) you can always add more terminal nodes. Also, one-hot encoding should be sufficient.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.