0
$\begingroup$

I am trying to implement a ML model, using the RandomForestClassifier. It is a binary classification problem.

The timestamp is a very important feature for me. So I divided the timestamp-column to date and time and then further to year, month (01-12), day_in_month (01-31), weekday (Mon-Sun, OneHot encoded), hour_in_day (00-23) and minute (00-59). I encoded the month, day_in_month, hour_in_day and minute as cyclical data as described here: https://ianlondon.github.io/blog/encoding-cyclical-features-24hour-time/ and gained 1% in accuracy (almost nothing.. but okay, as it doesn't cost much to encode like that)

Now my question is: Does it make sense, to derive from the date-column new columns "is_weekend", "is_holiday", "is_1night_prior_to_weekend", "is_1night_prior_to_holiday" (all of these 4 columns have just 0 or 1 as values), and to derive from the hour column, columns like "work_time" (filled with "before work", "work", "lunchbreak", "after work", "sleep"), or something like a column "part_of_day" with 4 values for ex.: "morning", "lunchtime", "afternoon", "evening" and "night"?

Does these from original data derived columns help the RF-Classifier make better predictions? Or does correlation damage the algorithm, and will cause no gain in the accuracy, because the information is somehow already in the data? Thanks!

$\endgroup$
1
$\begingroup$

RandomForest are robust against correlated/redundant and irrelevant features. So just try it and see if improves the accuracy. RFs are relatively good at modeling non-linear features, but you may end up with a more accurate, simpler or robust model with such features. It depends on your data!

You can then look at the feature importances to understand which features were selected. But note that when two or more features are redundant, only one of them will tend to show up in importances (cause the other ones don't add information).

$\endgroup$

Your Answer

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

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