3
$\begingroup$

I have a multi class classification problem where I should predict the passengers for flights (0-7 classes). The training set consists of the following features:

  • Date of the flight
  • Mean of the weeks that the passengers bought their tickets
  • Standard Deviation of the above

I extracted from the date, the day of the week, the month and if the flight is in a high season. What other features could I extract from the date? How could I use the mean and standard deviation to create new features?

$\endgroup$

3 Answers 3

2
$\begingroup$

Date fields are quite interesting data since the limit of what you can "feature engineer" with them is your imagination. However, it is difficult to know a priori if one of them will improve your model before you try it.

Here some ideas:

  1. Year
  2. Month (1-12)
  3. Day of Month (1-31)
  4. Day of week (1-7)
  5. Week of year (1-52)
  6. The quarter of the year (1-4)
  7. Is it weekend or weekday (0,1)
  8. Season (Winter, Spring, Summer, Autumn)

If you have also the time on the date field, then you can try these:

  1. Hour of day (1-24)
  2. Part of the day based on eating habits (breakfast, lunch, dinner etc)

If you have the destination of the flight, then you can use an external source and get the holidays or specific "big events"

  1. Is the flight during a holiday (0,1)
  2. What is the distance in days from the closest holiday (before and after the flight)
  3. Any big event on the destination like Olympic Games, Superbowl, Football finals etc
$\endgroup$
1
$\begingroup$

You could assume a normal distribution of weeks the customers bought their tickets, use mean and standard deviation as parameters of each customers individual distribution, calculate quantiles for each customer (e.g. 2.5%, 25%, 75% and 97.5%) and use them as additional features.

$\endgroup$
0
$\begingroup$

To add on to @Tasos, if you have passengers who have taken multiple flights you can also calculate the lag between flights / bookings, the number of flights taken in total, the number of flights taken within a time period, etc. You could then also layer means, medians, and standard deviations onto these features.

An important consideration when feature engineering date variables is the "distance" between encodings. As an example, you might encode Sunday == 7 and Monday == 1. By most metrics, the "distance" between these two encodings would be quite large, even though we know in reality that there isn't that much difference between them. (Similar examples include December == 12 and January == 1; last week of year 1 == 52 and first week of year 2 == 1).

A neat solution to this is to use cyclical transformations like sin and cos, adjusting appropriately for periodicity.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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