Skip to content
Closed
Changes from all commits
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
5 changes: 3 additions & 2 deletions src/ports/postgres/modules/convex/mlp_igd.py_in
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ def mlp(schema_madlib, source_table, output_table, independent_varname,
)
"""
it.update(train_sql)
if it_args['state_size'] == -1:
it_args['state_size'] = it.get_state_size()
if it.kwargs['state_size'] == -1:
it.kwargs['state_size'] = it.get_state_size()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if condition will be True for every iteration since it_args['state_size'] is not updated after the first time it goes into the if statement. So we will end up running the query in it.get_state_size() multiple times which is unnecessary (the state_size will not change). Can we update it_args['state_size'] too inside this if statement (or something similar which will preclude this if statement from evaluating to True after the first time)? Something simple would be, but feel free to do anything else that might be cleaner/efficient:

if it_args['state_size'] == -1:
    it.kwargs['state_size'] = it.get_state_size()
    it_args['state_size'] = it.kwargs['state_size']

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing it out! Yeah, I missed correcting the if condition here. Fixed it now.



if it.test("""
{iteration} >= {n_iterations}
Expand Down