hyperparameter-optimizer 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyperparameter-optimizer
3
+ Version: 0.1.1
4
+ Summary: A lightweight Python library for hyperparameter tuning using Metaheuristic algorithms.
5
+ Home-page: https://github.com/real-ahmed-moussa/hyperparameter-optimizer
6
+ Author: Dr. Ahmed Moussa
7
+ Author-email: ahmedyosrihamdy@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: numpy
16
+ Requires-Dist: scikit-learn
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # Hyperparameter Optimizer
29
+
30
+ A lightweight and flexible Python library for hyperparameter tuning using metaheuristic techniques.
31
+ Currently, the library includes **Particle Swarm Optimization (PSO)** only.
32
+
33
+ Designed for Scikit-learn-compatible models, this package offers an easy-to-use interface for optimizing model performance in just a few lines.
34
+
35
+ ![PyPI version](https://img.shields.io/pypi/v/hyperparameter-optimizer.svg)
36
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
37
+ [![Downloads](https://static.pepy.tech/personalized-badge/hyperparameter-optimizer?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/hyperparameter-optimizer)
38
+
39
+ ---
40
+
41
+ ## 📦 Installation
42
+
43
+ Install from PyPI:
44
+
45
+ ```bash
46
+ pip install hyperparameter-optimizer
47
+ ```
48
+
49
+ ---
50
+
51
+ ## ⚙️ Features
52
+
53
+ - ✅ Metaheuristic optimization using Particle Swarm Optimization (PSO)
54
+ - ✅ Supports continuous, integer, and categorical hyperparameters
55
+ - ✅ Compatible with any Scikit-learn estimator
56
+ - ✅ Custom scoring metrics
57
+ - ✅ Cross-validation built-in
58
+ - ✅ Verbose logging and full traceability
59
+
60
+ ---
61
+
62
+ ## 📚 API Reference
63
+
64
+ ### `HyperparameterOptimizer`
65
+
66
+ ```python
67
+ HyperparameterOptimizer(
68
+ obj_func, # machine learning model or pipeline being created
69
+ params, # dictionary of parameters for which the model is to be optimized.
70
+ scoring, # scoring metric (e.g., 'accuracy')
71
+ opt_type="max", # type of optimization: "max" for maximization (default) or "min" for minimization.
72
+ cv=5, # number of cross-validation folds
73
+ verbose=1 # binary with a value of 1 (default) to show iteration information.
74
+ )
75
+ ```
76
+
77
+ ### `optimizePS`
78
+
79
+ ```python
80
+ optimizePS(
81
+ features, # training features
82
+ target, # training target
83
+ nParticles, # number of particles in the swarm
84
+ bounds, # List of (min, max) tuples or a categorical list of choices.
85
+ # If either min/max is non-integer, the algorithm shall consider them as floats (i.e., continuous).
86
+ w=0.5, # inertia weight
87
+ c1=1, # cognitive weight
88
+ c2=1, # social weight
89
+ maxIter=20, # maximum number of iterations
90
+ mutation_prob=0.1 # Mutation probability -- for discrete hyperparameters
91
+ )
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 🚀 Quickstart
97
+
98
+ Here's a basic example of how to use **Hyperparameter Optimizer** with a Scikit-learn model (e.g., `RandomForestClassifier`):
99
+
100
+ ```python
101
+ from sklearn.datasets import load_iris
102
+ from sklearn.ensemble import RandomForestClassifier
103
+ from hyperparameter_optimizer import HyperparameterOptimizer
104
+
105
+ # Load data
106
+ X, y = load_iris(return_X_y=True)
107
+
108
+ # Define parameter space
109
+ param_space = {
110
+ 'n_estimators': [],
111
+ 'max_depth': [],
112
+ 'criterion': []
113
+ }
114
+
115
+ # Initialize the optimizer
116
+ optimizer = HyperparameterOptimizer(
117
+ obj_func=RandomForestClassifier(),
118
+ params=param_space,
119
+ scoring='accuracy',
120
+ opt_type='max',
121
+ cv=3,
122
+ verbose=1
123
+ )
124
+
125
+ # Run optimization
126
+ particles, Gbest_history, Gbest_pos, Gbest_score = optimizer.optimizePS(
127
+ features=X,
128
+ target=y,
129
+ nParticles=10,
130
+ bounds=[(10, 1000), (1, 10), ['gini', 'entropy']],
131
+ maxIter=10
132
+ )
133
+
134
+ print("Best Params:", Gbest_pos)
135
+ print("Best Score:", Gbest_score)
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 🧠 How It Works
141
+
142
+ This library uses **Particle Swarm Optimization (PSO)** to explore the hyperparameter space by simulating a group of candidate solutions ("particles") moving through the search space. Each particle adjusts its position based on personal and global bests discovered during the search, converging toward an optimal solution.
143
+
144
+ ---
145
+
146
+ ## 📜 License
147
+
148
+ This project is licensed under the **MIT License**.
149
+ © 2025 **Dr. Ahmed Moussa**
150
+
151
+ ---
152
+
153
+ ## 🤝 Contributing
154
+
155
+ Pull requests are welcome.
156
+ For major changes, please open an issue first to discuss what you would like to change.
157
+
158
+ ---
159
+
160
+ ## 📫 Contact
161
+
162
+ For feedback, bugs, or collaboration ideas:
163
+
164
+ - **GitHub**: [@real-ahmed-moussa](https://github.com/real-ahmed-moussa)
165
+
166
+ ---
167
+
168
+ ## ⭐️ Show Your Support
169
+
170
+ If you find this project useful, consider giving it a ⭐️ on [GitHub](https://github.com/real-ahmed-moussa/hyperparameter-optimizer)!
@@ -0,0 +1,143 @@
1
+ # Hyperparameter Optimizer
2
+
3
+ A lightweight and flexible Python library for hyperparameter tuning using metaheuristic techniques.
4
+ Currently, the library includes **Particle Swarm Optimization (PSO)** only.
5
+
6
+ Designed for Scikit-learn-compatible models, this package offers an easy-to-use interface for optimizing model performance in just a few lines.
7
+
8
+ ![PyPI version](https://img.shields.io/pypi/v/hyperparameter-optimizer.svg)
9
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
10
+ [![Downloads](https://static.pepy.tech/personalized-badge/hyperparameter-optimizer?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/hyperparameter-optimizer)
11
+
12
+ ---
13
+
14
+ ## 📦 Installation
15
+
16
+ Install from PyPI:
17
+
18
+ ```bash
19
+ pip install hyperparameter-optimizer
20
+ ```
21
+
22
+ ---
23
+
24
+ ## ⚙️ Features
25
+
26
+ - ✅ Metaheuristic optimization using Particle Swarm Optimization (PSO)
27
+ - ✅ Supports continuous, integer, and categorical hyperparameters
28
+ - ✅ Compatible with any Scikit-learn estimator
29
+ - ✅ Custom scoring metrics
30
+ - ✅ Cross-validation built-in
31
+ - ✅ Verbose logging and full traceability
32
+
33
+ ---
34
+
35
+ ## 📚 API Reference
36
+
37
+ ### `HyperparameterOptimizer`
38
+
39
+ ```python
40
+ HyperparameterOptimizer(
41
+ obj_func, # machine learning model or pipeline being created
42
+ params, # dictionary of parameters for which the model is to be optimized.
43
+ scoring, # scoring metric (e.g., 'accuracy')
44
+ opt_type="max", # type of optimization: "max" for maximization (default) or "min" for minimization.
45
+ cv=5, # number of cross-validation folds
46
+ verbose=1 # binary with a value of 1 (default) to show iteration information.
47
+ )
48
+ ```
49
+
50
+ ### `optimizePS`
51
+
52
+ ```python
53
+ optimizePS(
54
+ features, # training features
55
+ target, # training target
56
+ nParticles, # number of particles in the swarm
57
+ bounds, # List of (min, max) tuples or a categorical list of choices.
58
+ # If either min/max is non-integer, the algorithm shall consider them as floats (i.e., continuous).
59
+ w=0.5, # inertia weight
60
+ c1=1, # cognitive weight
61
+ c2=1, # social weight
62
+ maxIter=20, # maximum number of iterations
63
+ mutation_prob=0.1 # Mutation probability -- for discrete hyperparameters
64
+ )
65
+ ```
66
+
67
+ ---
68
+
69
+ ## 🚀 Quickstart
70
+
71
+ Here's a basic example of how to use **Hyperparameter Optimizer** with a Scikit-learn model (e.g., `RandomForestClassifier`):
72
+
73
+ ```python
74
+ from sklearn.datasets import load_iris
75
+ from sklearn.ensemble import RandomForestClassifier
76
+ from hyperparameter_optimizer import HyperparameterOptimizer
77
+
78
+ # Load data
79
+ X, y = load_iris(return_X_y=True)
80
+
81
+ # Define parameter space
82
+ param_space = {
83
+ 'n_estimators': [],
84
+ 'max_depth': [],
85
+ 'criterion': []
86
+ }
87
+
88
+ # Initialize the optimizer
89
+ optimizer = HyperparameterOptimizer(
90
+ obj_func=RandomForestClassifier(),
91
+ params=param_space,
92
+ scoring='accuracy',
93
+ opt_type='max',
94
+ cv=3,
95
+ verbose=1
96
+ )
97
+
98
+ # Run optimization
99
+ particles, Gbest_history, Gbest_pos, Gbest_score = optimizer.optimizePS(
100
+ features=X,
101
+ target=y,
102
+ nParticles=10,
103
+ bounds=[(10, 1000), (1, 10), ['gini', 'entropy']],
104
+ maxIter=10
105
+ )
106
+
107
+ print("Best Params:", Gbest_pos)
108
+ print("Best Score:", Gbest_score)
109
+ ```
110
+
111
+ ---
112
+
113
+ ## 🧠 How It Works
114
+
115
+ This library uses **Particle Swarm Optimization (PSO)** to explore the hyperparameter space by simulating a group of candidate solutions ("particles") moving through the search space. Each particle adjusts its position based on personal and global bests discovered during the search, converging toward an optimal solution.
116
+
117
+ ---
118
+
119
+ ## 📜 License
120
+
121
+ This project is licensed under the **MIT License**.
122
+ © 2025 **Dr. Ahmed Moussa**
123
+
124
+ ---
125
+
126
+ ## 🤝 Contributing
127
+
128
+ Pull requests are welcome.
129
+ For major changes, please open an issue first to discuss what you would like to change.
130
+
131
+ ---
132
+
133
+ ## 📫 Contact
134
+
135
+ For feedback, bugs, or collaboration ideas:
136
+
137
+ - **GitHub**: [@real-ahmed-moussa](https://github.com/real-ahmed-moussa)
138
+
139
+ ---
140
+
141
+ ## ⭐️ Show Your Support
142
+
143
+ If you find this project useful, consider giving it a ⭐️ on [GitHub](https://github.com/real-ahmed-moussa/hyperparameter-optimizer)!
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyperparameter-optimizer
3
+ Version: 0.1.1
4
+ Summary: A lightweight Python library for hyperparameter tuning using Metaheuristic algorithms.
5
+ Home-page: https://github.com/real-ahmed-moussa/hyperparameter-optimizer
6
+ Author: Dr. Ahmed Moussa
7
+ Author-email: ahmedyosrihamdy@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: numpy
16
+ Requires-Dist: scikit-learn
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: license
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # Hyperparameter Optimizer
29
+
30
+ A lightweight and flexible Python library for hyperparameter tuning using metaheuristic techniques.
31
+ Currently, the library includes **Particle Swarm Optimization (PSO)** only.
32
+
33
+ Designed for Scikit-learn-compatible models, this package offers an easy-to-use interface for optimizing model performance in just a few lines.
34
+
35
+ ![PyPI version](https://img.shields.io/pypi/v/hyperparameter-optimizer.svg)
36
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
37
+ [![Downloads](https://static.pepy.tech/personalized-badge/hyperparameter-optimizer?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/hyperparameter-optimizer)
38
+
39
+ ---
40
+
41
+ ## 📦 Installation
42
+
43
+ Install from PyPI:
44
+
45
+ ```bash
46
+ pip install hyperparameter-optimizer
47
+ ```
48
+
49
+ ---
50
+
51
+ ## ⚙️ Features
52
+
53
+ - ✅ Metaheuristic optimization using Particle Swarm Optimization (PSO)
54
+ - ✅ Supports continuous, integer, and categorical hyperparameters
55
+ - ✅ Compatible with any Scikit-learn estimator
56
+ - ✅ Custom scoring metrics
57
+ - ✅ Cross-validation built-in
58
+ - ✅ Verbose logging and full traceability
59
+
60
+ ---
61
+
62
+ ## 📚 API Reference
63
+
64
+ ### `HyperparameterOptimizer`
65
+
66
+ ```python
67
+ HyperparameterOptimizer(
68
+ obj_func, # machine learning model or pipeline being created
69
+ params, # dictionary of parameters for which the model is to be optimized.
70
+ scoring, # scoring metric (e.g., 'accuracy')
71
+ opt_type="max", # type of optimization: "max" for maximization (default) or "min" for minimization.
72
+ cv=5, # number of cross-validation folds
73
+ verbose=1 # binary with a value of 1 (default) to show iteration information.
74
+ )
75
+ ```
76
+
77
+ ### `optimizePS`
78
+
79
+ ```python
80
+ optimizePS(
81
+ features, # training features
82
+ target, # training target
83
+ nParticles, # number of particles in the swarm
84
+ bounds, # List of (min, max) tuples or a categorical list of choices.
85
+ # If either min/max is non-integer, the algorithm shall consider them as floats (i.e., continuous).
86
+ w=0.5, # inertia weight
87
+ c1=1, # cognitive weight
88
+ c2=1, # social weight
89
+ maxIter=20, # maximum number of iterations
90
+ mutation_prob=0.1 # Mutation probability -- for discrete hyperparameters
91
+ )
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 🚀 Quickstart
97
+
98
+ Here's a basic example of how to use **Hyperparameter Optimizer** with a Scikit-learn model (e.g., `RandomForestClassifier`):
99
+
100
+ ```python
101
+ from sklearn.datasets import load_iris
102
+ from sklearn.ensemble import RandomForestClassifier
103
+ from hyperparameter_optimizer import HyperparameterOptimizer
104
+
105
+ # Load data
106
+ X, y = load_iris(return_X_y=True)
107
+
108
+ # Define parameter space
109
+ param_space = {
110
+ 'n_estimators': [],
111
+ 'max_depth': [],
112
+ 'criterion': []
113
+ }
114
+
115
+ # Initialize the optimizer
116
+ optimizer = HyperparameterOptimizer(
117
+ obj_func=RandomForestClassifier(),
118
+ params=param_space,
119
+ scoring='accuracy',
120
+ opt_type='max',
121
+ cv=3,
122
+ verbose=1
123
+ )
124
+
125
+ # Run optimization
126
+ particles, Gbest_history, Gbest_pos, Gbest_score = optimizer.optimizePS(
127
+ features=X,
128
+ target=y,
129
+ nParticles=10,
130
+ bounds=[(10, 1000), (1, 10), ['gini', 'entropy']],
131
+ maxIter=10
132
+ )
133
+
134
+ print("Best Params:", Gbest_pos)
135
+ print("Best Score:", Gbest_score)
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 🧠 How It Works
141
+
142
+ This library uses **Particle Swarm Optimization (PSO)** to explore the hyperparameter space by simulating a group of candidate solutions ("particles") moving through the search space. Each particle adjusts its position based on personal and global bests discovered during the search, converging toward an optimal solution.
143
+
144
+ ---
145
+
146
+ ## 📜 License
147
+
148
+ This project is licensed under the **MIT License**.
149
+ © 2025 **Dr. Ahmed Moussa**
150
+
151
+ ---
152
+
153
+ ## 🤝 Contributing
154
+
155
+ Pull requests are welcome.
156
+ For major changes, please open an issue first to discuss what you would like to change.
157
+
158
+ ---
159
+
160
+ ## 📫 Contact
161
+
162
+ For feedback, bugs, or collaboration ideas:
163
+
164
+ - **GitHub**: [@real-ahmed-moussa](https://github.com/real-ahmed-moussa)
165
+
166
+ ---
167
+
168
+ ## ⭐️ Show Your Support
169
+
170
+ If you find this project useful, consider giving it a ⭐️ on [GitHub](https://github.com/real-ahmed-moussa/hyperparameter-optimizer)!
@@ -2,12 +2,12 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='hyperparameter-optimizer',
5
- version='0.1.0',
5
+ version='0.1.1',
6
6
  description='A lightweight Python library for hyperparameter tuning using Metaheuristic algorithms.',
7
7
  long_description=open('README.md').read(),
8
8
  long_description_content_type='text/markdown',
9
9
  author='Dr. Ahmed Moussa',
10
- author_email='ahmedyosrihamdy@example.com',
10
+ author_email='ahmedyosrihamdy@gmail.com',
11
11
  url='https://github.com/real-ahmed-moussa/hyperparameter-optimizer',
12
12
  license='MIT',
13
13
  packages=find_packages(),
@@ -1,34 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: hyperparameter-optimizer
3
- Version: 0.1.0
4
- Summary: A lightweight Python library for hyperparameter tuning using Metaheuristic algorithms.
5
- Home-page: https://github.com/real-ahmed-moussa/hyperparameter-optimizer
6
- Author: Dr. Ahmed Moussa
7
- Author-email: ahmedyosrihamdy@example.com
8
- License: MIT
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
- Requires-Python: >=3.7
14
- Description-Content-Type: text/markdown
15
- Requires-Dist: numpy
16
- Requires-Dist: scikit-learn
17
- Dynamic: author
18
- Dynamic: author-email
19
- Dynamic: classifier
20
- Dynamic: description
21
- Dynamic: description-content-type
22
- Dynamic: home-page
23
- Dynamic: license
24
- Dynamic: requires-dist
25
- Dynamic: requires-python
26
- Dynamic: summary
27
-
28
- # hyperparameter-optimizer
29
- A lightweight Python library for hyperparameter tuning using Metaheuristic algorithms.
30
-
31
- ## Installation
32
-
33
- ```bash
34
- pip install hyperparameter-optimizer
@@ -1,7 +0,0 @@
1
- # hyperparameter-optimizer
2
- A lightweight Python library for hyperparameter tuning using Metaheuristic algorithms.
3
-
4
- ## Installation
5
-
6
- ```bash
7
- pip install hyperparameter-optimizer
@@ -1,34 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: hyperparameter-optimizer
3
- Version: 0.1.0
4
- Summary: A lightweight Python library for hyperparameter tuning using Metaheuristic algorithms.
5
- Home-page: https://github.com/real-ahmed-moussa/hyperparameter-optimizer
6
- Author: Dr. Ahmed Moussa
7
- Author-email: ahmedyosrihamdy@example.com
8
- License: MIT
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
- Requires-Python: >=3.7
14
- Description-Content-Type: text/markdown
15
- Requires-Dist: numpy
16
- Requires-Dist: scikit-learn
17
- Dynamic: author
18
- Dynamic: author-email
19
- Dynamic: classifier
20
- Dynamic: description
21
- Dynamic: description-content-type
22
- Dynamic: home-page
23
- Dynamic: license
24
- Dynamic: requires-dist
25
- Dynamic: requires-python
26
- Dynamic: summary
27
-
28
- # hyperparameter-optimizer
29
- A lightweight Python library for hyperparameter tuning using Metaheuristic algorithms.
30
-
31
- ## Installation
32
-
33
- ```bash
34
- pip install hyperparameter-optimizer