rodrigo-arenas / Sklearn-genetic-opt

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

[PR] generation param in DeltaThreshold callback #67

Closed rodrigo-arenas closed 3 years ago

rodrigo-arenas commented 3 years ago

This PR adds the parameter generations to the DeltaThreshold callback.

Now it compares the maximum and minimum values of a metric from the last generations, instead of just the current and previous ones. The default value is 2, so the behavior remains the same as in previous versions.

This is an implementation of the described in issue #64

codecov[bot] commented 3 years ago

Codecov Report

Merging #67 (a8a706d) into master (e9dfb5c) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #67   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           19        19           
  Lines          726       725    -1     
=========================================
- Hits           726       725    -1     
Impacted Files Coverage Δ
sklearn_genetic/callbacks/early_stoppers.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e9dfb5c...a8a706d. Read the comment docs.

shadi2018 commented 2 years ago

Hello I have the results in the console . would you please tell me how i can delect NaN 3= max-depth ,Balanced_accuracy_bayer= 0.890 gen nevals fitness fitness_std fitness_max fitness_min 0 5 nan nan nan nan 1 7 0.980865 0.00113267 0.982649 0.979315
INFO: ThresholdStopping callback met its criteria INFO: Stopping the algorithm cv_results :::::: GAFeatureSelectionCV(cv=StratifiedKFold(n_splits=4, random_state=0, shuffle=True), estimator=RandomForestClassifier(class_weight='balanced_subsample', max_depth=4), generations=10, mutation_probability=0.01, population_size=5, return_train_score=True, scoring=make_scorer(my_score_loss_func)) [[205 0] [ 5 7]] balanced_accuracy_sklearn: 4_GESA549NR3C1_RFC:: 0.7917 balanced_accuracy_bayer: 4_GES__A549NR3C1___RFC:: 0.9881