Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 3 Preprocessing notebook #2

Closed
nbwosm opened this issue Dec 20, 2021 · 3 comments
Closed

Chapter 3 Preprocessing notebook #2

nbwosm opened this issue Dec 20, 2021 · 3 comments

Comments

@nbwosm
Copy link

nbwosm commented Dec 20, 2021

Hello,
In the Chapter 3 Preprocessing notebook there seem to be several errors in the code.

When installing 'featuretools[tsfresh]' in colab the following error occurs:
WARNING: featuretools 0.27.1 does not provide the extra 'tsfresh'

When running the first code bracket using feature tools in colab the following error occurs:
TypeError: import_optional_dependency() got an unexpected keyword argument 'errors'

It appears colab installs featuretools version 0.27.1
If I install the most recent version of featuretoolls (i.e., 1.3.0) and run the code bracket below Automated Feature Extraction I get the following error:
AttributeError: 'EntitySet' object has no attribute 'entity_from_dataframe'

If it is versioning that is an issue, please let me know what version of featuretools the code in the book was based on. If it is not versioning, would you be able to advise what the issue is?

Let me know if you have any questions. Thanks!

Best,
Nils

@benman1
Copy link
Collaborator

benman1 commented Dec 27, 2021

Hi Nils
Sorry about not getting back to you earlier (I am just recovering from COVID). Thanks for buying my book. I hope you are enjoying it, apart from this difficulty reproducing some results. Thanks for bringing this to my attention.

I've just run pip install featuretools[tsfresh] in colab and I didn't see the warning you noticed. Is that what you did?

I think I found the code you are referring to on page 88 in the print edition. If you have any other issues, a page number or an actual code listing would be very helpful. It can make it much faster for me (or anyone else) to know where to start looking.

Let's start installing featuretools on colab

pip install featuretools[tsfresh]

We can check the version using pip show:

pip show featuretools

I get this here (version 1.3.0):

Name: featuretools
Version: 1.3.0
Summary: a framework for automated feature engineering
Home-page: https://featuretools.com
Author: Feature Labs, Inc.
Author-email: [email protected]
License: BSD 3-clause
Location: /usr/local/lib/python3.7/dist-packages
Requires: distributed, dask, woodwork, numpy, pyyaml, psutil, scipy, click, tqdm, pandas, cloudpickle
Required-by: featuretools-tsfresh-primitives

The problematic code looks like this (simplified and with all imports):

import featuretools as ft
from featuretools.primitives import Minute, Hour, Day, Month, Year, Weekday
import pandas as pd

data = pd.DataFrame({"Time": ['2014-01-01 01:41:50'], 'Target': [0]})
data['index'] = data.index
es = ft.EntitySet("My EntitySet")

From featuretools' changelog, it's apparent, there have been lots of changes. These changes were very recent (October) - so immediately before this book came out.

Therefore:

Solution 1

Use the older version of featuretools:

pip install featuretools<1.0.0

Solution 2

With featuretools version >=1.0.0, here's what works as well:

Instead of entity_from_dataframe use add_dataframe.

In the code segment in question, this would be:

es.add_dataframe(
    dataframe_name="data",
    dataframe=data,
    index="index",
    time_index="Time",
)

And the arguments in ft.dfs seem to have changed slightly as well, so the next line becomes:

fm, features = ft.dfs(
    entityset=es, target_dataframe_name="data", trans_primitives=[Minute, Hour, Day, Month, Year, Weekday]
  )

As a friendly note: it sounds a bit harsh to start an issue by saying you found several errors if what you are describing sounds much more like a change in its dependencies. I can assure you the code ran at some point, but libraries (dependencies) change all the time.

@nbwosm
Copy link
Author

nbwosm commented Dec 30, 2021

Hi Ben,

Thanks for the response and helpful suggestions! I hope you're feeling better. Duly noted on the tone. I wasn't trying to be harsh, just trying to figure out what the problem was. If there is a better place to ask such questions, please let me know. Looking forward to reading the rest of the book. Thanks again!

Best,
Nils

@nbwosm nbwosm closed this as completed Dec 30, 2021
@benman1
Copy link
Collaborator

benman1 commented Dec 30, 2021

No problem at all, Nils. Thank you for reporting this! I am actually really happy that we had this discussion here, so other people can benefit from it. I can even link to this issue from the repo readme. Please let me know if there are any other questions - anywhere is fine, here or on linkedin, twitter, etc. If you have any other feedback, do let me know, please - I am always trying to find things to improve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants