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

Fix DFPTraining validation set option #709

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, c: Config, model_kwargs: dict = None, epochs=30, validation_s

self._epochs = epochs

if (validation_size > 0.0 and validation_size < 1.0):
if (validation_size >= 0.0 and validation_size < 1.0):
self._validation_size = validation_size
else:
raise ValueError("validation_size={0} should be a positive float in the "
Expand Down Expand Up @@ -85,13 +85,15 @@ def on_data(self, message: MultiDFPMessage):
# Only train on the feature columns
train_df = train_df[train_df.columns.intersection(self._config.ae.feature_columns)]
validation_df = None
run_validation = False

# Split into training and validation sets
if self._validation_size > 0.0:
train_df, validation_df = train_test_split(train_df, test_size=self._validation_size, shuffle=False)
run_validation = True

logger.debug("Training AE model for user: '%s'...", user_id)
model.fit(train_df, epochs=self._epochs, val=validation_df)
model.fit(train_df, epochs=self._epochs, val=validation_df, run_validation=run_validation)
logger.debug("Training AE model for user: '%s'... Complete.", user_id)

output_message = MultiAEMessage(message.meta,
Expand Down