Giter Site home page Giter Site logo

Comments (6)

abeusher avatar abeusher commented on August 16, 2024

I'm experiencing the same error when I make the call to model.save()

from decision-forests.

abeusher avatar abeusher commented on August 16, 2024

Hey @sibyjackgrove

I'm experiencing the same error when I make the call to model.save()

I found this related issue: tensorflow/tensorflow#44984

After looking at my input data (train and test) I found that one of the columns was missing a header name. It was a column with an observation ID that uniquely identified each item in my input data.

After updating my CSV files by adding the column header 'id' (no quotes in file) to those two columns, the decision-forests library worked correctly.

I recommend you double check your input data and ensure:
all of the columns have a name in the header
none of the header names have a space or tab embedded in them.

from decision-forests.

abeusher avatar abeusher commented on August 16, 2024

@googlebot I recommend you update the exception handling in decision-forests to have a more intuitive error message to the engineer who experiences this issue in the future.

from decision-forests.

sibyjackgrove avatar sibyjackgrove commented on August 16, 2024

@abeusher Thanks for the tip. I removed the column names with spaces and tried again. But I am getting the same error.
So I removed other special characters like .,, and % from the column names. Now it is saving.

from decision-forests.

achoum avatar achoum commented on August 16, 2024

Thanks both for the report and the debugging! :)

It seems the default signature created by the keras model serialization does not support all characters.

Starting with the 0.1.6, TF-DF will raise an explicit error message if the feature contains one of those characters. The error can be turned into a warning for users who write custom export signatures. I'll also look into an alternative solution that does not forbid any character in the feature name.

New error message

train_df = pd.DataFrame({"label":[0,1,0,1],"f 1":[0,1,0,1]})
model = tfdf.keras.RandomForestModel()
model.fit(tfdf.keras.pd_dataframe_to_tf_dataset(train_df, label="label"))

ValueError: One or more feature names are not compatible with the Keras API: The feature name "f 1" contains a space or a tab character. This problem can be solved in one of two ways: (1; Recommended) Update the feature name(s) to be compatible. (2) Disable this error message (fail_on_non_keras_compatible_feature_name=False) and only use part of the compatible Keras API.

from decision-forests.

sibyjackgrove avatar sibyjackgrove commented on August 16, 2024

Thanks for the update. I was able to make model.save work by removing spaces as well as characters like '%', and '.' in the column names.

from decision-forests.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.