1717## 🌟 Overview
1818
1919** MetaSklearn** is a flexible and extensible Python library that brings metaheuristic optimization to
20- hyperparameter tuning of scikit-learn models. It provides a seamless interface to optimize hyperparameters
20+ hyperparameter tuning of ` scikit-learn ` models. It provides a seamless interface to optimize hyperparameters
2121using nature-inspired algorithms from the [ Mealpy] ( https://github.com/thieu1995/mealpy ) library.
2222It is designed to be user-friendly and efficient, making it easy to integrate into your machine learning workflow.
2323
2424
2525## 🚀 Features
2626
27- - ✅ Hyperparameter optimization with ** metaheuristic algorithms**
27+ - ✅ Hyperparameter optimization by ** metaheuristic algorithms** with ` mealpy ` .
2828- ✅ Compatible with any ** scikit-learn** model (SVM, RandomForest, XGBoost, etc.)
2929- ✅ Supports ** classification** and ** regression** tasks
3030- ✅ Custom and scikit-learn scoring support
@@ -200,7 +200,7 @@ from metasklearn import StringVar
200200
201201var = StringVar(valid_sets = (" linear" , " poly" , " rbf" ), name = " kernel" )
202202```
203- Used for categorical parameters with a limited number of choices, e.g., ` kernel ` in SVM.
203+ Used for string parameters with a limited number of choices, e.g., ` kernel ` in SVM. Value None can be set also .
204204
205205#### 4. ` BinaryVar ` – Binary Variable (0 or 1)
206206``` python
@@ -218,31 +218,42 @@ var = BoolVar(n_vars=1, name="use_bias")
218218```
219219Used for Boolean-type arguments such as ` fit_intercept ` , ` use_bias ` , etc.
220220
221- #### 6. ` PermutationVar ` – Permutation Variable
221+ #### 6. ` CategoricalVar ` - A set of mixed discrete variables such as int, float, string, None
222222``` python
223- from metasklearn import PermutationVar
223+ from metasklearn import CategoricalVar
224224
225- var = PermutationVar( valid_set = ( 1 , 2 , 5 , 10 ), name = " job_order " )
225+ var = CategoricalVar( valid_sets = (( 3 ., None , " alpha " ), ( 5 , 12 , 32 ), ( " auto " , " exp " , " sin " )), name = " categorical " )
226226```
227- Used for optimization problems involving permutations, like scheduling or routing.
228227
229- #### 7. ` MixedSetVar ` – Mixed-Type Set Variable
228+ This type of variable is useful when a hyperparameter can take on a predefined set of mixed values,
229+ such as: Mixed types of parameters in optimization tasks (int, string, bool, float,...).
230+
231+ #### 7. ` SequenceVar ` - Variables as tuple, list, or set
232+ ``` python
233+ from metasklearn import SequenceVar
234+
235+ var = SequenceVar(valid_sets = ((10 , ), (20 , 15 ), (30 , 10 , 5 )), return_type = list , name = " hidden_layer_sizes" )
236+ ```
237+
238+ This type of variable is useful for defining hyperparameters that represent sequences, such as the sizes of hidden layers in a neural network.
239+
240+ #### 8. ` PermutationVar ` – Permutation Variable
230241``` python
231- from metasklearn import MixedSetVar
242+ from metasklearn import PermutationVar
232243
233- var = MixedSetVar( valid_sets = (( 10 , 15 ), ( 20 , 10 ), ( 30 , 5 )), name = " mixed_choice " )
244+ var = PermutationVar( valid_set = ( 1 , 2 , 5 , 10 ), name = " job_order " )
234245```
235- Used when the parameter can take values of different types (int, string, bool, float, set,...) .
246+ Used for optimization problems involving permutations, like scheduling or routing .
236247
237- #### 8 . ` TransferBinaryVar ` – Transfer Binary Variable
248+ #### 9 . ` TransferBinaryVar ` – Transfer Binary Variable
238249``` python
239250from metasklearn import TransferBinaryVar
240251
241252var = TransferBinaryVar(n_vars = 1 , tf_func = " vstf_01" , lb = - 8 ., ub = 8 ., all_zeros = True , name = " transfer_binary" )
242253```
243254Used in binary search spaces that support transformation-based metaheuristics.
244255
245- #### 9 . ` TransferBoolVar ` – Transfer Boolean Variable
256+ #### 10 . ` TransferBoolVar ` – Transfer Boolean Variable
246257``` python
247258from metasklearn import TransferBoolVar
248259
@@ -254,7 +265,7 @@ Used in Boolean search spaces with transferable logic between states.
254265
255266``` python
256267from metasklearn import (IntegerVar, FloatVar, StringVar, BinaryVar, BoolVar,
257- PermutationVar, MixedSetVar , TransferBinaryVar, TransferBoolVar)
268+ PermutationVar, CategoricalVar, SequenceVar , TransferBinaryVar, TransferBoolVar)
258269
259270param_bounds = [
260271 IntegerVar(lb = 1 , ub = 20 , name = " n_neighbors" ),
@@ -263,8 +274,8 @@ param_bounds = [
263274 BinaryVar(name = " use_feature" ),
264275 BoolVar(name = " fit_bias" ),
265276 PermutationVar(valid_set = (1 , 2 , 5 , 10 ), name = " job_order" ),
266- MixedSetVar (valid_sets = [0.1 , " relu" , False ], name = " activation_choice" ),
267- MixedSetVar (valid_sets = ((10 , 15 ), (20 , 10 ), (30 , 5 )), name = " mixed_choice" ),
277+ CategoricalVar (valid_sets = [0.1 , " relu" , False , None , 3 ], name = " activation_choice" ),
278+ SequenceVar (valid_sets = ((10 ,), (20 , 10 ), (30 , 50 , 5 )), name = " mixed_choice" ),
268279 TransferBinaryVar(name = " bin_transfer" ),
269280 TransferBoolVar(name = " bool_transfer" )
270281]
0 commit comments