Skip to content

Comments

Improve grid generation for #207#426

Open
thijssnelleman wants to merge 7 commits intomainfrom
improve-grid-generation
Open

Improve grid generation for #207#426
thijssnelleman wants to merge 7 commits intomainfrom
improve-grid-generation

Conversation

@thijssnelleman
Copy link
Collaborator

@thijssnelleman thijssnelleman commented Feb 20, 2026

Based on the description of #207, I have revamped grid generator to work completely with generators instead of in memory grids.

  1. Each hyperparameter gets a constructed tuple or generator (Cannot reduce categorical/ordinal/constant in memory space, their impact should be very limited)
  2. Generators are fed into a itertools.product to do a cartesian product
  3. Conditional parameters get added a "None" value to their possible values, to represent inactivity, which are filtered out when constructing the configuration from the sample
  4. Samples are tested and discarded when invalid.

Biggest issue: I did a timing test based on the pytests, measuring simply with time.time.

The first test yielded the results;
New: 0.008675813674926758 (Slight improvement)
Old: 0.00872802734375

The second, with some conditionals:
New: 0.017199277877807617 (Order of magnitude slower)
Old: 0.008735895156860352

This could be terrible for large search spaces. One thing I (over) simplified was to simply generate the entire grid by the generator and discarding the invalid configurations (i.e. no 'smart' checking for active/inactive parameters). This means a lot of invalid configurations are generated in the second case: 558 / 576 are invalid (96.9%).

I hoped that the check would be fast enough to mitigate this slow down, but perhaps this is not the case.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant