ワンクリックで
parallel-grid-search
Parallelize hyperparameter grid search using joblib for efficient multi-core execution.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Parallelize hyperparameter grid search using joblib for efficient multi-core execution.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Handles reading, populating, and saving .docx files using the python-docx library. Use this skill for any tasks involving template filling or modifying Word documents.
Perform various data analysis on SEC 13-F and obtain some insights of fund activities such as number of holdings, AUM, and change of holdings between two quarters.
This skill includes search capability in 13F, such as fuzzy search a fund information using possibly inaccurate name, or fuzzy search a stock cusip info using its name.
A comprehensive PDF toolkit for advanced data extraction and document analysis. Beyond text and table extraction, this tool is optimized for visual layout reasoning: it can map graphical elements to coordinates (such as determining appointment times based on their position on a calendar timeline) and identify color-coded features (e.g., distinguishing high-priority blocks from flexible blue-colored entries). Use this skill when the task requires interpreting schedule layouts, calculating durations from visual spans, or resolving scheduling conflicts based on the spatial and color properties of a PDF document.
Build deterministic, verifiable data visualizations with D3.js (v6). Generate standalone HTML/SVG (and optional PNG) from local data files without external network dependencies. Use when tasks require charts, plots, axes/scales, legends, tooltips, or data-driven SVG output.
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
| name | parallel-grid-search |
| description | Parallelize hyperparameter grid search using joblib for efficient multi-core execution. |
Use joblib to parallelize expensive computations across multiple CPU cores, significantly speeding up grid search over hyperparameter combinations.
pip install joblib scikit-learn
from joblib import Parallel, delayed
import itertools
def evaluate_hyperparams(hp_combination, data, evaluation_func):
"""Evaluate a single hyperparameter combination."""
result = evaluation_func(hp_combination, data)
return {**hp_combination, **result}
# Define hyperparameter grid
param_grid = {
'min_samples': [3, 4, 5, 6, 7, 8, 9],
'epsilon': [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24],
'shape_weight': [0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9]
}
# Generate all combinations
combinations = [
{k: v for k, v in zip(param_grid.keys(), vals)}
for vals in itertools.product(*param_grid.values())
]
# Parallel evaluation
n_jobs = -1 # Use all available cores
results = Parallel(n_jobs=n_jobs, verbose=10)(
delayed(evaluate_hyperparams)(combo, data, eval_func)
for combo in combinations
)
from tqdm import tqdm
def parallel_grid_search_batched(param_grid, data, evaluation_func, n_jobs=-1):
"""
Perform parallel grid search with progress tracking.
Args:
param_grid: Dictionary of parameter names to lists of values
data: Dataset to evaluate on
evaluation_func: Function that takes (hyperparams_dict, data) -> results_dict
n_jobs: Number of parallel jobs (-1 = all cores)
Returns:
List of result dictionaries
"""
# Generate all combinations
combinations = [
{k: v for k, v in zip(param_grid.keys(), vals)}
for vals in itertools.product(*param_grid.values())
]
# Parallel evaluation with progress bar
results = Parallel(n_jobs=n_jobs)(
delayed(evaluation_func)(combo, data)
for combo in tqdm(combinations, desc="Grid Search", total=len(combinations))
)
return results
# Use batch_size for memory efficiency
results = Parallel(n_jobs=-1, batch_size='auto')(
delayed(expensive_function)(item)
for item in data
)
# verbose=10 prints progress every 10 jobs
# verbose=0 is silent, verbose=1 prints at start/end
results = Parallel(n_jobs=-1, verbose=10)(
delayed(task)(x) for x in items
)
# Default is 'loky' (good for most tasks)
# 'threading' is lighter but can have GIL issues
# 'processes' spawns new processes
results = Parallel(n_jobs=-1, backend='loky')(
delayed(task)(x) for x in items
)
import pandas as pd
results = Parallel(n_jobs=-1)(
delayed(evaluate_hyperparams)(combo, data, eval_func)
for combo in combinations
)
# Convert to DataFrame
results_df = pd.DataFrame(results)
# Filter and sort
filtered = results_df[results_df['f1'] > 0.5].sort_values('f1', ascending=False)
n_jobs=-1 to use all cores; use -2 to leave one core freetqdm package