I'm using a Random Forest Classifier on some data, and I have two date field, StartDate and EndDate. Does it make sense to create a derived/calculated column Duration, that would be the difference between the end and the start dates in days (or weeks)? Would this give extra power to the classifier, or is this already covered, as the decision trees within the model would create corresponding "buckets" for this based on the dates?

  • $\begingroup$ How is start date / end date encoded internaly? String, or unix seconds? $\endgroup$
    – Peter
    Commented Feb 16, 2022 at 15:09
  • $\begingroup$ AFAIR it's a string, but I transform it into date type. $\endgroup$
    – lte__
    Commented Feb 16, 2022 at 19:25

1 Answer 1


When the date (string) is converted to a date, I suppose the date is interpreted as Unix time. In this case, RF might understand that $t_1$ follows after $t_0$. However, since „start date“ seems to be the nativ starting point here, it makes sense to include a „duration“ variable (starting at „start date“, e.g. in days). This will likely make it easier for the model to capture possible time trends for each entity to which this trend applies.

However, if there is only one entity to which the time trend might apply, the generated feature „duration“ will likely have little effect (since the scale of a variable has little effect in RF models). If you can afford it, just try adding „duration“.


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.