First, I LOVE featuretools. It has made my work so much easier and more efficient. One quick question: I was just looking for a full list of non-custom agg & trans primitives, but couldn't seem to find it. Do I just take the list of methods in the API and substitute lowercase (and underscore between) for capitals?
1 Answer
If you run featuretools.list_primitives()
, it returns a dataframe of all the names of the primitives. The strings in the "name" column can be provided to ft.dfs
>>> import featuretools as ft
>>> ft.list_primitives()
name type description
0 percent_true aggregation Determines the percent of `True` values.
1 last aggregation Determines the last value in a list.
2 num_true aggregation Counts the number of `True` values.
3 std aggregation Computes the dispersion relative to the mean v...
4 num_unique aggregation Determines the number of distinct values, igno...
5 sum aggregation Calculates the total addition, ignoring `NaN`.
6 skew aggregation Computes the extent to which a distribution di...
7 mode aggregation Determines the most commonly repeated value.
8 time_since_first aggregation Calculates the time elapsed since the first da...
9 max aggregation Calculates the highest value, ignoring `NaN` v...
10 median aggregation Determines the middlemost number in a list of ...
11 mean aggregation Computes the average for a list of values.
12 time_since_last aggregation Calculates the time elapsed since the last dat...
Additionally, you can also import and pass the primitive class directly. For example, this these two calls are equivalent.
>>> from featuretools.primitives import Max, TimeSincePrevious
>>> ft.dfs(agg_primtives=[Max, TimeSincePrevious], ...)
>>> ft.dfs(agg_primtives=["max", "time_since_previous"], ...)
It can be helpful to import the primitive object if you need to modify a controllable parameter. For instance, to make TimeSincePrevious
return in the units of hours (the default if seconds)
>>> ft.dfs(agg_primtives=[Max, TimeSincePrevious(unit="hours")], ...)