1

are there built-in primitives performing absolute and relative differences between two numeric columns? Two date columns?

Sergey Skripko
  • 336
  • 1
  • 8

1 Answers1

1

This can currently be done for numeric columns, but not datetimes.

With interaction terms, we typically recommend you manually define the specific features you want. For example, here is how to define difference and absolute difference between to numeric features

import featuretools as ft

es = ft.demo.load_retail(nrows=1000)

total = ft.Feature(es["order_products"]["total"])
unit_price = ft.Feature(es["order_products"]["unit_price"])

difference = unit_price - total
absolute_diff = abs(difference)

fm = ft.calculate_feature_matrix(features=[difference, absolute_diff], entityset=es)
fm.head()

this returns

                  unit_price - total  ABSOLUTE(unit_price - total)
order_product_id                                                  
0                           -21.0375                       21.0375
1                           -27.9675                       27.9675
2                           -31.7625                       31.7625
3                           -27.9675                       27.9675
4                           -27.9675                       27.9675

We could also pass those values those values to ft.dfs as seed features if we wanted other primitives to stack on top of them.

Max Kanter
  • 2,006
  • 6
  • 16