Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:51:22 +08:00
commit 53ae9034e6
10 changed files with 380 additions and 0 deletions

View 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.

View File

@@ -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"]
}
}

View 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>