Initial commit
This commit is contained in:
15
.claude-plugin/plugin.json
Normal file
15
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "hyperparameter-tuner",
|
||||
"description": "Optimize hyperparameters using grid/random/bayesian search",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Claude Code Plugins",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"skills": [
|
||||
"./skills"
|
||||
],
|
||||
"commands": [
|
||||
"./commands"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# hyperparameter-tuner
|
||||
|
||||
Optimize hyperparameters using grid/random/bayesian search
|
||||
15
commands/tune-hyper.md
Normal file
15
commands/tune-hyper.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
description: Execute AI/ML task with intelligent automation
|
||||
---
|
||||
|
||||
# AI/ML Task Executor
|
||||
|
||||
You are an AI/ML specialist. When this command is invoked:
|
||||
|
||||
1. Analyze the current context and requirements
|
||||
2. Generate appropriate code for the ML task
|
||||
3. Include data validation and error handling
|
||||
4. Provide performance metrics and insights
|
||||
5. Save artifacts and generate documentation
|
||||
|
||||
Support modern ML frameworks and best practices.
|
||||
69
plugin.lock.json
Normal file
69
plugin.lock.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/ai-ml/hyperparameter-tuner",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "48e8fcf7349a05c6fd3ae2b076b210179825b6c6",
|
||||
"treeHash": "08bb4549442c1425f8e62a344e09d75e9e7a509f93087a721b30114b4deb5161",
|
||||
"generatedAt": "2025-11-28T10:18:30.273644Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "hyperparameter-tuner",
|
||||
"description": "Optimize hyperparameters using grid/random/bayesian search",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "199e5dd193b345ee2e13dc9dc26424b6553c47e418e7c4df4b6b1703c60a46e0"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "61b74ac368f9e96f99ae0074c8b5a9b1ff1fcfff00f7f85a42322e9dd683a434"
|
||||
},
|
||||
{
|
||||
"path": "commands/tune-hyper.md",
|
||||
"sha256": "043efb83e2f02fc6d0869c8a3a7388d6e49f6c809292b93dd6a97a1b142e5647"
|
||||
},
|
||||
{
|
||||
"path": "skills/hyperparameter-tuner/SKILL.md",
|
||||
"sha256": "8a6ad2853b21be6b8341304120aa268c1595bdbadd0d01120149184b15a36314"
|
||||
},
|
||||
{
|
||||
"path": "skills/hyperparameter-tuner/references/README.md",
|
||||
"sha256": "7df3b6a5431b9260338c59649cfca782dfd0a39bd3d7ac27eaa04a519dba5bf8"
|
||||
},
|
||||
{
|
||||
"path": "skills/hyperparameter-tuner/scripts/README.md",
|
||||
"sha256": "b415c5d13c98cd432c9200f0f65ad56384bbf6f711b1f3db11baa95328f927aa"
|
||||
},
|
||||
{
|
||||
"path": "skills/hyperparameter-tuner/assets/visualization_template.html",
|
||||
"sha256": "00234d617f351400d696b622ca0bdf4dc9d61325e3b5d23329253fe1f084b72f"
|
||||
},
|
||||
{
|
||||
"path": "skills/hyperparameter-tuner/assets/hyperparameter_space_template.json",
|
||||
"sha256": "8cfa756e76387959c52d42c64082b699c3a599c72f39b7c852c0db214f0ffd95"
|
||||
},
|
||||
{
|
||||
"path": "skills/hyperparameter-tuner/assets/README.md",
|
||||
"sha256": "eff420094d1d05f18de7ca36e78472f2abd6d0b5850325fc61e714f0560fe2ce"
|
||||
}
|
||||
],
|
||||
"dirSha256": "08bb4549442c1425f8e62a344e09d75e9e7a509f93087a721b30114b4deb5161"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
54
skills/hyperparameter-tuner/SKILL.md
Normal file
54
skills/hyperparameter-tuner/SKILL.md
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
name: tuning-hyperparameters
|
||||
description: |
|
||||
This skill enables Claude to optimize machine learning model hyperparameters using grid search, random search, or Bayesian optimization. It is used when the user requests hyperparameter tuning, model optimization, or improvement of model performance. The skill analyzes the current context, generates code for the specified search strategy, handles data validation and errors, and provides performance metrics. Trigger terms include "tune hyperparameters," "optimize model," "grid search," "random search," and "Bayesian optimization."
|
||||
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
|
||||
version: 1.0.0
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This skill empowers Claude to fine-tune machine learning models by automatically searching for the optimal hyperparameter configurations. It leverages different search strategies (grid, random, Bayesian) to efficiently explore the hyperparameter space and identify settings that maximize model performance.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Analyzing Requirements**: Claude analyzes the user's request to determine the model, the hyperparameters to tune, the search strategy, and the evaluation metric.
|
||||
2. **Generating Code**: Claude generates Python code using appropriate ML libraries (e.g., scikit-learn, Optuna) to implement the specified hyperparameter search. The code includes data loading, preprocessing, model training, and evaluation.
|
||||
3. **Executing Search**: The generated code is executed to perform the hyperparameter search. The plugin iterates through different hyperparameter combinations, trains the model with each combination, and evaluates its performance.
|
||||
4. **Reporting Results**: Claude reports the best hyperparameter configuration found during the search, along with the corresponding performance metrics. It also provides insights into the search process and potential areas for further optimization.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
This skill activates when you need to:
|
||||
- Optimize the performance of a machine learning model.
|
||||
- Automatically search for the best hyperparameter settings.
|
||||
- Compare different hyperparameter search strategies.
|
||||
- Improve model accuracy, precision, recall, or other relevant metrics.
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Optimizing a Random Forest Model
|
||||
|
||||
User request: "Tune hyperparameters of a Random Forest model using grid search to maximize accuracy on the iris dataset. Consider n_estimators and max_depth."
|
||||
|
||||
The skill will:
|
||||
1. Generate code to perform a grid search over the specified hyperparameters (n_estimators, max_depth) of a Random Forest model using the iris dataset.
|
||||
2. Execute the grid search and report the best hyperparameter combination and the corresponding accuracy score.
|
||||
|
||||
### Example 2: Using Bayesian Optimization
|
||||
|
||||
User request: "Optimize a Gradient Boosting model using Bayesian optimization with Optuna to minimize the root mean squared error on the Boston housing dataset."
|
||||
|
||||
The skill will:
|
||||
1. Generate code to perform Bayesian optimization using Optuna to find the best hyperparameters for a Gradient Boosting model on the Boston housing dataset.
|
||||
2. Execute the optimization and report the best hyperparameter combination and the corresponding RMSE.
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Define Search Space**: Clearly define the range and type of values for each hyperparameter to be tuned.
|
||||
- **Choose Appropriate Strategy**: Select the hyperparameter search strategy (grid, random, Bayesian) based on the complexity of the hyperparameter space and the available computational resources. Bayesian optimization is generally more efficient for complex spaces.
|
||||
- **Use Cross-Validation**: Implement cross-validation to ensure the robustness of the evaluation metric and prevent overfitting.
|
||||
|
||||
## Integration
|
||||
|
||||
This skill integrates seamlessly with other Claude Code plugins that involve machine learning tasks, such as data analysis, model training, and deployment. It can be used in conjunction with data visualization tools to gain insights into the impact of different hyperparameter settings on model performance.
|
||||
7
skills/hyperparameter-tuner/assets/README.md
Normal file
7
skills/hyperparameter-tuner/assets/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for hyperparameter-tuner skill
|
||||
|
||||
- [ ] hyperparameter_space_template.json: Template for defining the hyperparameter search space.
|
||||
- [ ] example_data.csv: Example dataset for training the model.
|
||||
- [ ] visualization_template.html: Template for visualizing the hyperparameter tuning results.
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"_comment": "Template for defining the hyperparameter search space. This file should be used as a guide for creating your own hyperparameter configuration.",
|
||||
"algorithm": {
|
||||
"_comment": "The search algorithm to use. Options: 'grid', 'random', 'bayesian'.",
|
||||
"type": "string",
|
||||
"default": "random",
|
||||
"enum": ["grid", "random", "bayesian"]
|
||||
},
|
||||
"objective": {
|
||||
"_comment": "The metric to optimize. The plugin will attempt to maximize this metric.",
|
||||
"type": "string",
|
||||
"default": "val_loss"
|
||||
},
|
||||
"max_trials": {
|
||||
"_comment": "The maximum number of trials to run. Each trial will explore a different set of hyperparameters.",
|
||||
"type": "integer",
|
||||
"default": 10
|
||||
},
|
||||
"hyperparameters": {
|
||||
"_comment": "A dictionary of hyperparameters to search. Each key is the name of the hyperparameter, and the value is a dictionary defining the search space for that hyperparameter.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"learning_rate": {
|
||||
"_comment": "Example: Learning rate for a neural network.",
|
||||
"type": "number",
|
||||
"distribution": "loguniform",
|
||||
"min": 0.0001,
|
||||
"max": 0.1
|
||||
},
|
||||
"num_layers": {
|
||||
"_comment": "Example: Number of layers in a neural network.",
|
||||
"type": "integer",
|
||||
"distribution": "uniform",
|
||||
"min": 2,
|
||||
"max": 6
|
||||
},
|
||||
"dropout_rate": {
|
||||
"_comment": "Example: Dropout rate for regularization.",
|
||||
"type": "number",
|
||||
"distribution": "uniform",
|
||||
"min": 0.0,
|
||||
"max": 0.5
|
||||
},
|
||||
"batch_size": {
|
||||
"_comment": "Example: Batch size for training.",
|
||||
"type": "integer",
|
||||
"distribution": "categorical",
|
||||
"values": [32, 64, 128, 256]
|
||||
},
|
||||
"optimizer": {
|
||||
"_comment": "Example: Optimization algorithm to use",
|
||||
"type": "string",
|
||||
"distribution": "categorical",
|
||||
"values": ["adam", "sgd", "rmsprop"]
|
||||
}
|
||||
},
|
||||
"required": ["learning_rate", "num_layers"]
|
||||
},
|
||||
"early_stopping": {
|
||||
"_comment": "Parameters for early stopping. If enabled, the tuning process will stop if the objective metric does not improve for a specified number of epochs.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"monitor": {
|
||||
"_comment": "The metric to monitor for early stopping.",
|
||||
"type": "string",
|
||||
"default": "val_loss"
|
||||
},
|
||||
"patience": {
|
||||
"_comment": "The number of epochs with no improvement after which training will be stopped.",
|
||||
"type": "integer",
|
||||
"default": 3
|
||||
},
|
||||
"enabled": {
|
||||
"_comment": "Whether early stopping is enabled.",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
"required": ["monitor", "patience", "enabled"]
|
||||
}
|
||||
}
|
||||
113
skills/hyperparameter-tuner/assets/visualization_template.html
Normal file
113
skills/hyperparameter-tuner/assets/visualization_template.html
Normal file
@@ -0,0 +1,113 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Hyperparameter Tuning Results</title>
|
||||
<style>
|
||||
/* Basic styling for a modern look */
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background-color: #f4f4f4;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
color: #007bff;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 20px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.best-params {
|
||||
margin-top: 20px;
|
||||
padding: 15px;
|
||||
background-color: #e6f7ff;
|
||||
border: 1px solid #b3d9ff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.best-params h3 {
|
||||
color: #007bff;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Responsive design */
|
||||
@media (max-width: 600px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
table {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h1>Hyperparameter Tuning Results</h1>
|
||||
|
||||
<div class="best-params">
|
||||
<h3>Best Hyperparameters</h3>
|
||||
<p><strong>Metric:</strong> {{best_metric}}</p>
|
||||
<p><strong>Value:</strong> {{best_metric_value}}</p>
|
||||
<p><strong>Parameters:</strong> {{best_parameters}}</p>
|
||||
</div>
|
||||
|
||||
<h2>Trial Results</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Trial</th>
|
||||
<th>Parameters</th>
|
||||
<th>Metric Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{trial_results}}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2>Visualization</h2>
|
||||
<img src="{{visualization_url}}" alt="Hyperparameter Tuning Visualization">
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
11
skills/hyperparameter-tuner/references/README.md
Normal file
11
skills/hyperparameter-tuner/references/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# References
|
||||
|
||||
Bundled resources for hyperparameter-tuner skill
|
||||
|
||||
- [ ] grid_search_guide.md: Detailed explanation of grid search algorithm.
|
||||
- [ ] random_search_guide.md: Detailed explanation of random search algorithm.
|
||||
- [ ] bayesian_optimization_guide.md: Detailed explanation of Bayesian optimization algorithm.
|
||||
- [ ] hyperparameter_tuning_best_practices.md: Best practices for hyperparameter tuning.
|
||||
- [ ] supported_models.md: List of supported machine learning models.
|
||||
- [ ] evaluation_metrics_explained.md: Explanation of different evaluation metrics.
|
||||
- [ ] error_codes.md: List of error codes and their meanings.
|
||||
12
skills/hyperparameter-tuner/scripts/README.md
Normal file
12
skills/hyperparameter-tuner/scripts/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Scripts
|
||||
|
||||
Bundled resources for hyperparameter-tuner skill
|
||||
|
||||
- [ ] grid_search.py: Implements grid search algorithm for hyperparameter tuning.
|
||||
- [ ] random_search.py: Implements random search algorithm for hyperparameter tuning.
|
||||
- [ ] bayesian_optimization.py: Implements Bayesian optimization algorithm for hyperparameter tuning.
|
||||
- [ ] hyperparameter_space.py: Defines the search space for hyperparameters.
|
||||
- [ ] model_trainer.py: Trains the machine learning model with given hyperparameters.
|
||||
- [ ] evaluation_metrics.py: Calculates performance metrics for the trained model.
|
||||
- [ ] data_validation.py: Validates the input data for the model.
|
||||
- [ ] error_handling.py: Handles potential errors during hyperparameter tuning.
|
||||
Reference in New Issue
Block a user