0
$\begingroup$

I need to include a Maturity Date feature in my scikit-learn RandomForestClassifier model.

Since the day is too specific, I'm thinking of having a number with the format YYYYMM.

Any issues with this approach? Are there best practices to have dates as features?

$\endgroup$
3
  • $\begingroup$ Often it's better to normalize, but how are the maturity dates being used? Is this bonds or home loans or something like that? $\endgroup$
    – C8H10N4O2
    Jul 12 at 20:30
  • $\begingroup$ Yes, those are maturities of home loans. Probably instead of using the date it's better to have a number such "pending months" $\endgroup$
    – ps0604
    Jul 12 at 20:35
  • $\begingroup$ Depending on what kind of thing we're classifying here, it's going to be more likely that home loans maturity date would be better encoded as a normalized months until maturity or normalized maturity date, e.g., 0 is your earliest maturity and 1 is your latest maturity, 0.5 is halfway in between, etc. It's less likely that you would want to encode as a categorical. Is this for like prepay curves or prob. of default or loss severity or something? $\endgroup$
    – C8H10N4O2
    Jul 13 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.