alteryx / alteryx/featuretools
Featuretools generates stacked features on top of output from multi-output primitives that cause error upon calculation
- 主要语言
- Python
- 星标
- 7.7k
- 派生
- 915
- PR 合并指标
- 30 天内没有已合并 PR
描述
### Featuretools generates stacked features on top of output from multi-output primitives that cause error upon calculation
#### Bug Description
In some cases Featuretools will generate features that will result in an error being raised when calculate feature matrix is called. A simple example of this is demonstrated with the code below, using a simple custom multi-output primitive. An error results when trying to calculate the feature matrix. The problematic feature appears to be caused by stacking the `IsNull` transform primitive on top of one of the outputs of the custom `MultiOut` primitive.
```python
import pandas as pd
import featuretools as ft
from featuretools.primitives.base import AggregationPrimitive
from featuretools.tests.testing_utils import make_ecommerce_entityset
from featuretools.variable_types import Discrete
es = make_ecommerce_entityset()
class MultiOut(AggregationPrimitive):
name = "multi_out"
input_types = [Discrete]
return_type = Discrete
def __init__(self, n=3):
self.n = n
self.number_output_features = n
def get_function(self):
def multi_out(data, n=self.n):
return pd.Series(range(n))
return multi_out
features = ft.dfs(entityset=es,
target_entity='products',
trans_primitives=['is_null'],
agg_primitives=[MultiOut(2)],
max_depth=3,
features_only=True)
fm = ft.calculate_feature_matrix(entityset=es, features=features)
```
This results in the following error:
```
KeyError: 'MULTI_OUT(log.subregioncode, n=2)[0]'
```
Note, this error can also be reproduced on the `woodwork-integration` branch by redefining the custom primitive as follows:
```python
import pandas as pd
from featuretools.primitives.base import AggregationPrimitive
from woodwork.column_schema import ColumnSchema
from woodwork.logical_types import Categorical
class MultiOut(AggregationPrimitive):
name = "multi_out"
input_types = [ColumnSchema(semantic_tags={'category'})]
return_type = ColumnSchema(semantic_tags={'category'})
def __init__(self, n=3):
self.n = n
self.number_output_features = n
def get_function(self):
def multi_out(data, n=self.n):
return pd.Series(range(n))
return multi_out
```
贡献指南
评估
这个 Issue 还没有评估数据。