I have the dataset from here which contains the following features:

'Index', 'Arrival_Time', 'Creation_Time', 'x', 'y', 'z', 'User', 'Model', 'Device', 'gt' 

A snapshot of data would look like this:


I want to perform classification using a neural network for this dataset but first I am trying to figure out how to extract more usual features from 'Arrival_Time', 'Creation_Time'. The definition of these two features are:

Arrival_Time:   The time the measurement arrived to the sensing application
Creation_Time   The timestamp the OS attaches to the sample

Is there a way via scikit-learn to extract or encode these two features toward better features? Any hints are appreciated.

  • 1
    $\begingroup$ You can add various features like difference between arrival and creation time,average of those etc and use a neural network on top of that. If those are the relevant features it would learn to use them $\endgroup$
    – sww
    May 14, 2018 at 20:03

1 Answer 1


Month of year, week of year, week of month, day of year, day of week, hour of day, hour of week, minute of hour, second of minute, ... is leap year, is holiday, is Olympic year, ... # of events in the entire training data that were in the same (minute, hour, day, ...) as this one (commonly normalized by something else, such as the total number of events, or the total number sharing some attributes with this one), min/max/mean/variance of all values observed in the same (minute, hour, day, ...) as this one, ... You can generate hundreds of features like this.

Many of these are one-liners in pandas, like df[‘Arrival_Time’].dt.hour (assuming you already did pd.to_datetime() on that column).

Also, it’s good practice to circular encode the features that repeat, such as month of year: {cos,sin}(2 \pi month_of_year / 12) so that January and December are as close in feature space as January and February are.


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.