commit 53ae9034e656f2c41ed3dee10a57f0eb2ca65a79 Author: Zhongwei Li Date: Sat Nov 29 18:51:22 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..81d81d2 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -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" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..055f41e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# hyperparameter-tuner + +Optimize hyperparameters using grid/random/bayesian search diff --git a/commands/tune-hyper.md b/commands/tune-hyper.md new file mode 100644 index 0000000..7e9e4fa --- /dev/null +++ b/commands/tune-hyper.md @@ -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. diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..af97659 --- /dev/null +++ b/plugin.lock.json @@ -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": [] + } +} \ No newline at end of file diff --git a/skills/hyperparameter-tuner/SKILL.md b/skills/hyperparameter-tuner/SKILL.md new file mode 100644 index 0000000..ce4370f --- /dev/null +++ b/skills/hyperparameter-tuner/SKILL.md @@ -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. \ No newline at end of file diff --git a/skills/hyperparameter-tuner/assets/README.md b/skills/hyperparameter-tuner/assets/README.md new file mode 100644 index 0000000..5d37a09 --- /dev/null +++ b/skills/hyperparameter-tuner/assets/README.md @@ -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. diff --git a/skills/hyperparameter-tuner/assets/hyperparameter_space_template.json b/skills/hyperparameter-tuner/assets/hyperparameter_space_template.json new file mode 100644 index 0000000..78dbe6a --- /dev/null +++ b/skills/hyperparameter-tuner/assets/hyperparameter_space_template.json @@ -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"] + } +} \ No newline at end of file diff --git a/skills/hyperparameter-tuner/assets/visualization_template.html b/skills/hyperparameter-tuner/assets/visualization_template.html new file mode 100644 index 0000000..f72dc5b --- /dev/null +++ b/skills/hyperparameter-tuner/assets/visualization_template.html @@ -0,0 +1,113 @@ + + + + + + Hyperparameter Tuning Results + + + + +
+

Hyperparameter Tuning Results

+ +
+

Best Hyperparameters

+

Metric: {{best_metric}}

+

Value: {{best_metric_value}}

+

Parameters: {{best_parameters}}

+
+ +

Trial Results

+ + + + + + + + + + {{trial_results}} + +
TrialParametersMetric Value
+ +

Visualization

+ Hyperparameter Tuning Visualization +
+ + + \ No newline at end of file diff --git a/skills/hyperparameter-tuner/references/README.md b/skills/hyperparameter-tuner/references/README.md new file mode 100644 index 0000000..2013cfa --- /dev/null +++ b/skills/hyperparameter-tuner/references/README.md @@ -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. diff --git a/skills/hyperparameter-tuner/scripts/README.md b/skills/hyperparameter-tuner/scripts/README.md new file mode 100644 index 0000000..b225b1c --- /dev/null +++ b/skills/hyperparameter-tuner/scripts/README.md @@ -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.