Hyper-parameter search that rises from the ashes of interrupted experiments
Project description
HyperPhoenixCV 🐦🔥
"Rise from the ashes of interrupted experiments"
HyperPhoenixCV is a smart hyperparameter tuning library that, like the mythical phoenix, resumes after interruptions and continues searching for optimal solutions. Never lose hours of computation due to unexpected stops again!
Other languages: Русский
✨ Features
- 🔄 Resumable searches – Continue from the last checkpoint after any interruption.
- 🧠 Bayesian optimization – Find better parameters faster with intelligent search.
- 🎯 Multiple search strategies – Exhaustive grid search, random search, or predictive optimization.
- 📊 Multi‑metric evaluation – Score using multiple metrics (F1, accuracy, precision, etc.) simultaneously.
- 💾 Automatic checkpointing – Results are saved automatically to pickle files and CSV.
- 🔌 Scikit‑learn compatible – Seamlessly integrates with the scikit‑learn ecosystem.
🚀 Installation
Install from PyPI:
pip install hyperphoenixcv
Or install the latest development version from source:
git clone https://github.com/valeksan/hyperphoenixcv.git
cd hyperphoenixcv
pip install -e .
📖 Why HyperPhoenixCV?
The name HyperPhoenixCV refers to the mythical phoenix – a bird that rises from its ashes. In the same way, your hyperparameter search can "rise again" after an interruption, continuing from the last saved checkpoint instead of starting over from scratch.
The "CV" in the name highlights the library's focus on cross‑validation and machine‑learning workflows.
How It Differs from Plain GridSearchCV
| Feature | GridSearchCV |
HyperPhoenixCV |
|---|---|---|
| Resumability | Starts over after interruption | ✅ Continues from checkpoint |
| Optimization | Exhaustive search only | ✅ Bayesian, random, or exhaustive |
| Multi‑metric | Single metric at a time | ✅ Multiple metrics simultaneously |
| Checkpointing | Manual saving required | ✅ Automatic pickle & CSV export |
| Progress tracking | Limited | ✅ Verbose logs & intermediate results |
🛠️ Quick Start
Here’s a minimal example that shows the core workflow:
from hyperphoenixcv import HyperPhoenixCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
# Create a simple dataset
X, y = make_classification(n_samples=1000, n_features=20, random_state=42)
# Define the model and parameter grid
model = RandomForestClassifier()
param_grid = {
'n_estimators': [50, 100, 200],
'max_depth': [None, 10, 20],
'min_samples_split': [2, 5, 10]
}
# Create a HyperPhoenixCV instance with checkpointing
hp = HyperPhoenixCV(
estimator=model,
param_grid=param_grid,
scoring='accuracy',
cv=5,
checkpoint_path='my_experiment.pkl',
verbose=True
)
# Run the search (resumes automatically if interrupted)
hp.fit(X, y)
print("Best parameters:", hp.best_params_)
print("Best score:", hp.best_score_)
# Get top‑5 results
top_results = hp.get_top_results(5)
print(top_results)
🔁 Resuming an Interrupted Search
If the process is stopped (e.g., due to time limits), simply run the same script again – it will load the checkpoint and continue where it left off:
hp.fit(X, y) # Automatically resumes from 'my_experiment.pkl'
📚 Advanced Usage
Bayesian Optimization
Enable Bayesian optimization to reduce the number of evaluations:
hp = HyperPhoenixCV(
estimator=model,
param_grid=param_grid,
use_bayesian_optimization=True,
n_iter=30, # Number of Bayesian iterations
verbose=True
)
Random Search
Perform a random search over the parameter space:
hp = HyperPhoenixCV(
estimator=model,
param_grid=param_grid,
random_search=True,
n_iter=50 # Number of random combinations
)
Multiple Metrics
Evaluate using several metrics at once:
hp = HyperPhoenixCV(
estimator=model,
param_grid=param_grid,
scoring=['f1', 'accuracy', 'precision']
)
Exporting Results
Save all results to a CSV file for further analysis:
hp = HyperPhoenixCV(
estimator=model,
param_grid=param_grid,
results_csv='experiment_results.csv'
)
Custom Cross‑Validation Splitter
HyperPhoenixCV supports any cross‑validation splitter that follows the scikit‑learn interface (e.g., TimeSeriesSplit, GroupKFold, StratifiedKFold). You can pass a splitter object directly to the cv parameter:
from sklearn.model_selection import TimeSeriesSplit, GroupKFold
# Time‑series cross‑validation
ts_cv = TimeSeriesSplit(n_splits=5)
hp = HyperPhoenixCV(
estimator=model,
param_grid=param_grid,
cv=ts_cv, # Use the splitter object
scoring='accuracy'
)
# Group‑aware cross‑validation
group_cv = GroupKFold(n_splits=5)
hp = HyperPhoenixCV(
estimator=model,
param_grid=param_grid,
cv=group_cv,
scoring='accuracy'
)
# Then call fit with groups parameter
hp.fit(X, y, groups=groups)
See the full example: examples/custom_cv_example.py
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License – see the LICENSE file for details.
🙏 Acknowledgments
Thanks to the scikit‑learn community for the foundation on which this library is built.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hyperphoenixcv-0.3.0.tar.gz.
File metadata
- Download URL: hyperphoenixcv-0.3.0.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0452fbd8d6bec5eebaedb0f8f5b849b5c94053570f82841e0cb28c76001ac05
|
|
| MD5 |
6a3bc94bc63f8cc454b867167748a063
|
|
| BLAKE2b-256 |
262fdc3ff2f87e94091afd212bf30c5b422a6d957d35b199fb34dc0db6947eb8
|
File details
Details for the file hyperphoenixcv-0.3.0-py3-none-any.whl.
File metadata
- Download URL: hyperphoenixcv-0.3.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
651504ce4b7689556e777a94bf66a1956520547ddda4c465c2c22a66412035df
|
|
| MD5 |
e599a66131eedd0239de738f1559f7c7
|
|
| BLAKE2b-256 |
256cfc6b04b04bb1916bd3c790cef7d6bdc07725edacaa5b2b0b92c630590f7a
|