pythonpandasfeaturetoolsvaex

Can featuretools be used on a vaex dataframe?


I'm trying to play with automated feature engineering - I've got it to work on raw dataframes but I'm not sure to do it on out of memory dataframes such as vaex. My purpose is to find a way to use automated feature engineering when data frame exceeds memory.

I'm wondering if anyone has had any success? Here's what I'm doing/code:

#playing with vaex
#install items
# !pip install vaex
# !pip install --upgrade ipython
# !pip install numpy --upgrade
#if using colab you may have to restart your runtime
!pip install featuretools

#import items
import featuretools as ft
import vaex
import pandas as pd
vaex.multithreading.thread_count_default = 8
import vaex.ml

# Load the titanic dataset
df = vaex.ml.datasets.load_titanic()

# See the description
df.info()

# let's try to use featuretools to scale out the features on vaex
es = ft.EntitySet(id = 'titanic_data')
es = es.entity_from_dataframe(entity_id = 'df', dataframe = df.drop(['Survived']), 
                              variable_types = 
                              {
                                  'Embarked': ft.variable_types.Categorical,
                                  'Sex': ft.variable_types.Boolean,
                                  'Title': ft.variable_types.Categorical,
                                  'Family_Size': ft.variable_types.Numeric,
                                  'LastName': ft.variable_types.Categorical
                              },
                              index = 'PassengerId')

I get this error:

KeyError                                  Traceback (most recent call last)
<ipython-input-6-55607b93fccd> in <module>
      1 # let's try to use featuretools to scale out the features on vaex
      2 es = ft.EntitySet(id = 'titanic_data')
----> 3 es = es.entity_from_dataframe(entity_id = 'df', dataframe = df.drop(['Survived']), 
      4                               variable_types =
      5                               {

1 frames
/usr/local/lib/python3.7/dist-packages/vaex/dataframe.py in drop(self, columns, inplace, check)
   4758                 df._hide_column(column)
   4759             else:
-> 4760                 df._real_drop(column)
   4761         return df
   4762 

/usr/local/lib/python3.7/dist-packages/vaex/dataframe.py in _real_drop(self, item)
   4733             self.column_names.remove(name)
   4734         else:
-> 4735             raise KeyError('no such column or virtual_columns named %r' % name)
   4736         self.signal_column_changed.emit(self, name, "delete")
   4737         if hasattr(self, name):

KeyError: "no such column or virtual_columns named 'Survived'"

Is it possible to do what I'm doing? is it a error in my approach? Or do it in another way?


Solution

  • Currently, Featuretools does not work with vaex dataframes. There is some support for dask or koalas dataframes.