rodrigo-arenas / Sklearn-genetic-opt

ML hyperparameters tuning and features selection, using evolutionary algorithms.
https://sklearn-genetic-opt.readthedocs.io
MIT License
289 stars 73 forks source link

Add ConstantAdapter #96

Closed rodrigo-arenas closed 2 years ago

rodrigo-arenas commented 2 years ago

This PR adds the ConstantAdapter

This adapter is meant to be used internally by the package; when the user doesn't create an adapter but instead defines the crossover or mutation probability as a positive number, the package will convert it to a ConstantAdapter, so the library can use the internal API with the same methods in both cases. Because of this, its definition is:

$p(t; \alpha) = p_0$

With this change, the internal module of algorithms is modified and now expects an Adapter for both crossover and mutation probability.

codecov[bot] commented 2 years ago

Codecov Report

Merging #96 (dad16a3) into master (7a817e1) will increase coverage by 0.38%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   98.55%   98.93%   +0.38%     
==========================================
  Files          23       24       +1     
  Lines        1036     1037       +1     
==========================================
+ Hits         1021     1026       +5     
+ Misses         15       11       -4     
Impacted Files Coverage Δ
sklearn_genetic/__init__.py 100.00% <100.00%> (ø)
sklearn_genetic/algorithms.py 94.67% <100.00%> (+1.62%) :arrow_up:
sklearn_genetic/genetic_search.py 99.73% <100.00%> (+<0.01%) :arrow_up:
sklearn_genetic/schedules/__init__.py 100.00% <100.00%> (ø)
sklearn_genetic/schedules/schedulers.py 100.00% <100.00%> (ø)
sklearn_genetic/schedules/validations.py 100.00% <100.00%> (ø)

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more