How do I use Classification Learner with datetime value predictors?

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?

 Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 13 Sep. 2024
Bearbeitet: MathWorks Support Team am 13 Sep. 2024

1 Stimme

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:

Weitere Antworten (0)

Produkte

Version

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by