alteryx / alteryx/featuretools

== operator not defined for multioutput columns features

Abierto
#694 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
7.7k
Forks
915
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### == operator not defined for multioutput columns features

```py
import featuretools as ft
from featuretools.tests.testing_utils import make_ecommerce_entityset

es = make_ecommerce_entityset()

feature_defs = ft.dfs(entityset=es,
target_entity="customers",
agg_primitives=["n_most_common"],
trans_primitives=[],
features_only=True)

f = feature_defs[6]
f == f
```
```py
AssertionError Traceback (most recent call last)
in
----> 1 f == f

~/workspace/featuretools/featuretools/feature_base/feature_base.py in __eq__(self, other)
221 def __eq__(self, other):
222 """Compares to other by equality"""
--> 223 return self._handle_binary_comparision(other, primitives.Equal, primitives.EqualScalar)
224
225 def __ne__(self, other):

~/workspace/featuretools/featuretools/feature_base/feature_base.py in _handle_binary_comparision(self, other, Primitive, PrimitiveScalar)
215 def _handle_binary_comparision(self, other, Primitive, PrimitiveScalar):
216 if isinstance(other, FeatureBase):
--> 217 return Feature([self, other], primitive=Primitive)
218
219 return Feature([self], primitive=PrimitiveScalar(other))

~/workspace/featuretools/featuretools/feature_base/feature_base.py in __new__(self, base, entity, groupby, parent_entity, primitive, use_previous, where)
736 primitive=primitive,
737 groupby=groupby)
--> 738 return TransformFeature(base, primitive=primitive)
739
740 raise Exception("Unrecognized feature initialization")

~/workspace/featuretools/featuretools/feature_base/feature_base.py in __init__(self, base_features, primitive, name)
634
635 # R TODO handle stacking on sub-features
--> 636 assert all(bf.number_output_features == 1 for bf in base_features)
637
638 super(TransformFeature, self).__init__(entity=base_features[0].entity,

AssertionError:
```
-----

#### Bug/Feature Request Description

The == operator correctly checks for equality in single column output features. For features with multiple output columns, the operator throws an AssertionError.

Temporary workaround is to use `feature.unique_name()` to compare two features directly.

#### Expected Output

``

#### Output of ``featuretools.show_info()``

Featuretools version: 0.9.1
Featuretools installation directory: /Users/alex/workspace/featuretools/featuretools

SYSTEM INFO
-----------
python: 3.7.3.final.0
python-bits: 64
OS: Darwin
OS-release: 18.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

INSTALLED VERSIONS
------------------
numpy: 1.16.2
pandas: 0.24.2
tqdm: 4.31.1
toolz: 0.9.0
PyYAML: 5.1
cloudpickle: 0.8.0
future: 0.17.1
dask: 2.0.0
distributed: 1.26.0
psutil: 5.6.1
Click: 7.0
scikit-learn: 0.20.3
pip: 19.0.3
setuptools: 40.8.0

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.