Skip to content

Benchmark Early Stopping for the GapEncoder - #663

Closed
simonamaggio wants to merge 9 commits into
skrub-data:mainfrom
simonamaggio:gap_early_stopping
Closed

simonamaggio wants to merge 9 commits into
skrub-data:mainfrom
simonamaggio:gap_early_stopping

Conversation

@simonamaggio

@simonamaggio simonamaggio commented Jul 20, 2023 •

Copy link
Copy Markdown

This PR adds a script to benchmark the use of early stopping for GapEncoder.
The early stopping, implemented in a modified version of GapEncoder and enabled with early_stop=True, monitors the GapEncoder score every monitor_steps batches. As soon as the score increases (worsen) it triggers a counter with a limit given by patience batches. If after patience batches the score has not been decreased, the process is ended.

This PR is related to #593, where a previous benchmark is run to investigate GAPEncoder slowness.

@simonamaggio

Copy link
Copy Markdown
Author

Results of the comparison for a small dataset in skrub: employee_salaries:
Screenshot 2023-07-20 at 16 07 39

@simonamaggio

simonamaggio commented Jul 20, 2023 •

Copy link
Copy Markdown
Author

Remarks:

  • Should we add an early stopping to the GapEncoder class directly and modify the bench script ?
  • Should we add the min_delta parameter (like in pytorch), i.e. a decrease of more than or equal to min_delta, will count as improvement? For now there's no such parameter, so equivalent to min_delta=0.
  • Should we record the best encoder status so far (score, matrices, ...) so to restore it in case the score worsen instead? Here we always take the last score obtained.
  • The outer stopping tol should still be tuned to higher values according to Benchmark GapEncoder divergence #593 results.

@simonamaggio simonamaggio changed the title Add Early Stopping to GapEncoder Benchmark Early Stopping for the GapEncoder Jul 20, 2023
@LeoGrin

LeoGrin commented Jul 20, 2023 •

Copy link
Copy Markdown
Contributor

Should we record the best encoder status so far (score, matrices, ...) so to restore it in case the score worsen instead? Here we always take the last score obtained.

I think taking the last should be okay, though we can check when I run the benchmarks on more datasets. (also it decreases the memory usage).

Should we add the min_delta parameter (like in pytorch), i.e. a decrease of more than or equal to min_delta, will count as improvement? For now there's no such parameter, so equivalent to min_delta=0.

I think this would be useful! (I'll do it)

@LeoGrin LeoGrin added the benchmarks Something related to the benchmarks label Jul 21, 2023
@simonamaggio

simonamaggio commented Jul 21, 2023 •

Copy link
Copy Markdown
Author

Here is the updated result for commit 785082e

Screenshot 2023-07-21 at 15 50 59

@LeoGrin

LeoGrin commented Jul 26, 2023

Copy link
Copy Markdown
Contributor

Right now the version with early stopping is actually slower than the original version, I think because the score method is so long. I'll try to see if it can be sped up.

@LeoGrin

LeoGrin commented Aug 18, 2023

Copy link
Copy Markdown
Contributor

See #681

@LeoGrin LeoGrin closed this Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

benchmarks Something related to the benchmarks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants