How do I use Classification Learner with datetime value predictors?
6 views (last 30 days)
Show older comments
MathWorks Support Team
on 4 Aug 2016
Edited: MathWorks Support Team
on 4 Mar 2021
I have a large table of sensor data that I would like to run through a binary classification tree. Some of my column variables in the table are dates, which I would like to specify as possible predictors. I tried importing into the Classification Learner as datetime values. It didn't work, and it was marked as "unsuitable".
How do I use datetime values as predictors in Classification Learner App?
Accepted Answer
MathWorks Support Team
on 4 Mar 2021
Edited: MathWorks Support Team
on 4 Mar 2021
The Classification Learner App does not currently support datetime values. Our developers have been made aware of this issue and will consider it for future releases.
As a workaround, it is recommended to convert the datetime values using the "datenum" function. This simply converts the datetime value into a double that represents a serial date number. Please refer to the example code below:
>> table.date_1 = datenum(table.date_1)
Documentation for "datenum" function:
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!