-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36dae45
commit 5928aa1
Showing
1 changed file
with
132 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,138 @@ | ||
Hii | ||
# GridSearchHelper | ||
|
||
GridSearchHelper is a Python library designed to simplify hyperparameter tuning using Grid Search. It allows for automatic parameter grid generation and performs efficient grid search for machine learning models. | ||
A Python library to simplify hyperparameter tuning using scikit-learn's GridSearchCV. Automate parameter grid generation for various machine learning models and optimize your model's performance with ease. | ||
|
||
## Installation | ||
[](https://badge.fury.io/py/gridsearchhelper) | ||
[](https://opensource.org/licenses/MIT) | ||
[](https://www.python.org/downloads/) | ||
|
||
You can install GridSearchHelper from PyPI: | ||
## 🚀 Quick Start | ||
|
||
```bash | ||
pip install GridSearchHelper | ||
======= | ||
# Hyperparameter Tuning for Classifiers | ||
|
||
This project implements a hyperparameter tuning utility for multiple classifiers using `GridSearchCV` from `sklearn`. The supported classifiers include Random Forest, Gradient Boosting, AdaBoost, SVM, K-Nearest Neighbors, Logistic Regression, Decision Trees, Naive Bayes, MLP, and more. | ||
|
||
## Features | ||
- Grid search for hyperparameter optimization on a variety of models. | ||
- Support for additional custom parameters. | ||
- Cross-validation (CV) support for model evaluation. | ||
- Parallel processing for faster results. | ||
|
||
## Setup | ||
1. Clone this repository: | ||
``bash | ||
git clone https://github.com/alimovabdulla/GridSearchHelper.git | ||
>>>>>>> 27a8174 (Updated project with new features) | ||
pip install DridSearchHelper | ||
``` | ||
|
||
```python | ||
from GridSearchHelper import get_param_grid, perform_grid_search | ||
from sklearn.ensemble import RandomForestRegressor | ||
|
||
# Initialize your model | ||
model = RandomForestRegressor() | ||
|
||
# Get parameter grid automatically | ||
param_grid = get_param_grid(model) | ||
|
||
# Perform grid search | ||
best_params, best_score = perform_grid_search(model, param_grid, X_train, y_train) | ||
``` | ||
|
||
## 🔑 Key Features | ||
|
||
- 🤖 **Automatic Parameter Grid Generation**: No more manual parameter grid definition | ||
- 🔄 **Seamless scikit-learn Integration**: Works directly with GridSearchCV | ||
- 📊 **Multiple Model Support**: Compatible with various scikit-learn models | ||
- 🛠 **Easy to Use**: Simple API with just two main functions | ||
|
||
## 📋 Requirements | ||
|
||
- Python 3.6+ | ||
- scikit-learn | ||
- numpy | ||
- pandas | ||
|
||
## 💻 Installation | ||
|
||
### From PyPI | ||
```bash | ||
pip install gridsearchhelper | ||
``` | ||
|
||
### From Source | ||
```bash | ||
git clone https://github.com/alimovabdulla/GridSearchHelper.git | ||
cd GridSearchHelper | ||
pip install . | ||
``` | ||
|
||
## 📖 Usage Examples | ||
|
||
### ElasticNet Example | ||
|
||
```python | ||
from GridSearchHelper import get_param_grid, perform_grid_search | ||
from sklearn.linear_model import ElasticNet | ||
from sklearn.preprocessing import StandardScaler | ||
|
||
# Prepare your model | ||
model = ElasticNet(alpha=1) | ||
|
||
# Scale your features | ||
scaler = StandardScaler() | ||
X_train_scaled = scaler.fit_transform(X_train) | ||
|
||
# Get parameter grid and perform search | ||
param_grid = get_param_grid(model) | ||
best_params, best_score = perform_grid_search(model, param_grid, X_train_scaled, y_train) | ||
``` | ||
|
||
### RandomForest Example | ||
|
||
```python | ||
from GridSearchHelper import get_param_grid, perform_grid_search | ||
from sklearn.ensemble import RandomForestRegressor | ||
|
||
# Initialize model | ||
model = RandomForestRegressor() | ||
|
||
# Get grid and optimize | ||
param_grid = get_param_grid(model) | ||
best_params, best_score = perform_grid_search(model, param_grid, X_train, y_train) | ||
``` | ||
|
||
## 🛠 API Reference | ||
|
||
### get_param_grid(model) | ||
Generates parameter grid based on model type. | ||
|
||
**Parameters:** | ||
- `model`: scikit-learn model instance | ||
|
||
**Returns:** | ||
- Dictionary containing parameter grid | ||
|
||
### perform_grid_search(model, param_grid, X_train, y_train) | ||
Performs grid search with cross-validation. | ||
|
||
**Parameters:** | ||
- `model`: scikit-learn model instance | ||
- `param_grid`: Parameter grid dictionary | ||
- `X_train`: Training features | ||
- `y_train`: Target values | ||
|
||
**Returns:** | ||
- Tuple of (best_parameters, best_score) | ||
|
||
## 🤝 Contributing | ||
|
||
Contributions are welcome! Here's how you can help: | ||
|
||
1. 🍴 Fork the repository | ||
2. 🌿 Create a feature branch (`git checkout -b feature/amazing-feature`) | ||
3. 💻 Make your changes | ||
4. 📝 Commit your changes (`git commit -m 'Add amazing feature'`) | ||
5. 📤 Push to the branch (`git push origin feature/amazing-feature`) | ||
6. 🔄 Open a Pull Request | ||
|
||
## 📄 License | ||
|
||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. | ||
|
||
## 📞 Contact | ||
|
||
Abdullah Alimov - [@alimovabdulla](https://github.com/alimovabdulla) | ||
|
||
Project Link: [https://github.com/alimovabdulla/GridSearchHelper](https://github.com/alimovabdulla/GridSearchHelper) | ||
|
||
## ⭐️ Show your support | ||
|
||
Give a ⭐️ if this project helped you! |