5001-node-selection-algorithm speed increase. #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
20 minutes to less than 10 seconds on my test data.
To get this speed increase:
unique_combinations
and usedcombinations
from itertools.Pool
from multiprocessing to do a MapReduce on batches from unique_combinations.I do not have time to work on this code anymore. If needed, more speed could be achieved by using panda to read in the config and create a table that would allow unique combinations to be represented by indexes of that table. this would cut down some un-needed computation.
ComboAnalysis
could also be optimized by having a pre-allocated array for maintaining the best combinations. I saw significant time being spent in an array append method insideComboAnalysis
, with the way batches are being processed, this would be a significant speed increase.Another possible speed increase would be using a library like numpy for all math operations.
This code needs to be tested more than what I have done.