I am writing to you because I need to create a model that tells me whether or not a company will pay its taxes the next month.

For that I have data from 2017 to 2020, with characteristics such as size of the company, type of company, year, month and whether or not it pay taxes in that month and year.

How could I use the year and month features in the model, since I want to use the model to predict which companies will pay in 2021.

I say it's a classification model because the variable to predict is binary (yes or no). If I use the years as categorical data And applied a hotencoder the model could not predict for the year 2021 because it does not exist in the original dataset right?

So how could I use this data to train my classifier?

Because if I do not use the years and I limited myself to using the months. How does the model distinguish the month of January 2020 to the month of January of 2019?

  • $\begingroup$ Have you considered encoding the date of a tax payment as time index (i.e. number of days since say January 1, 2017)? Some ML models could generalize from such a numerical feature even for unseen values such as year 2021 payments. $\endgroup$
    – grov
    Jun 23, 2021 at 2:08

1 Answer 1


You will have to try few things,

  • Keeping year as Continuous feature and Month as OHE
  • Change month to a cyclic encoding i.e. Dec-18 is equidistant from Nov-18 and Jan-19
  • Create a new feature based on the number of days from a reference date [As suggested in the comment by @grov]

What approach will work will depend upon the underlying Data and Target relation.

You may check this Post. Disclaimer - [It is written by me]
The post explain the cyclic stuff.
Other reference link - stats.stackexchange


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.