Joblib parallel gridsearch
Perform parallel grid search using joblib. Use this skill whenever a task requires optimizing multiple hyperparameters simultaneously across CPU cores.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill joblib-parallel-gridsearchAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.0 KB, 203 tokens by cl100k_base, as published. Nobody here has run it
Parallel Grid Search with Joblib
Joblib is the standard library for multiprocessing in Python data science workloads.
Basic Usage
from joblib import Parallel, delayed
import itertools
def evaluate_params(param1, param2):
# Perform expensive computation
score = param1 + param2
return {'p1': param1, 'p2': param2, 'score': score}
# Define grid
param_grid = list(itertools.product([1, 2, 3], [0.1, 0.2]))
# Run in parallel
results = Parallel(n_jobs=-1, verbose=10)(
delayed(evaluate_params)(p1, p2) for p1, p2 in param_grid
)
Tips
n_jobs=-1uses all available CPU cores.- Pre-load data in the main process before spawning parallel workers to save memory.
- Pass required shared data as arguments to your delayed function.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.