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

Bug: StructuredDataClassifier ignores loss parameter #1874

Open
DF-Damm opened this issue Apr 4, 2023 · 0 comments
Open

Bug: StructuredDataClassifier ignores loss parameter #1874

DF-Damm opened this issue Apr 4, 2023 · 0 comments

Comments

@DF-Damm
Copy link

DF-Damm commented Apr 4, 2023

Bug Description

The StructuredDataClassifier trains with default loss and ignores any user input. Even setting the loss to some random string like loss='this is not a loss' does not change the behavior (or result in an error).

Bug Reproduction

import tensorflow as tf
import autokeras as ak

TRAIN_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/train.csv"
TEST_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/eval.csv"

train_file_path = tf.keras.utils.get_file("train.csv", TRAIN_DATA_URL)
test_file_path = tf.keras.utils.get_file("eval.csv", TEST_DATA_URL)

# Initialize the structured data classifier.
clf = ak.StructuredDataClassifier(
    overwrite=True, max_trials=3, loss='mse'
) 
# Feed the structured data classifier with training data.
clf.fit(
    # The path to the train.csv file.
    train_file_path,
    # The name of the label column.
    "survived",
    epochs=10,
)
# Print loss function used during training
model = clf.export_model()
print('loss function:', model.loss)

Expected Behavior

The model is supposed to be trained using the mean squared error, but it is actually being trained using <keras.losses.BinaryCrossentropy>.

Setup Details

  • OS: Windows
  • Python: 3
  • autokeras: 1.0.20
  • keras-tuner: 1.1.3
  • scikit-learn: 1.0.2
  • numpy: 1.21.5
  • pandas: 1.5.1
  • tensorflow: 2.9.1

Additional context

Upon examining the code, it appears that the user input is being overwritten at this point.

#1608 raises a similar issue as a feature request.

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

No branches or pull requests

1 participant