rsteca / Sklearn Deap
Licence: mit
Use evolutionary algorithms instead of gridsearch in scikit-learn
Stars: ✭ 633
Labels
Projects that are alternatives of or similar to Sklearn Deap
David Silver Reinforcement Learning
Notes for the Reinforcement Learning course by David Silver along with implementation of various algorithms.
Stars: ✭ 623 (-1.58%)
Mutual labels: jupyter-notebook
Toolkitten
A toolkit for #1millionwomentotech community.
Stars: ✭ 630 (-0.47%)
Mutual labels: jupyter-notebook
Kalman
Some Python Implementations of the Kalman Filter
Stars: ✭ 619 (-2.21%)
Mutual labels: jupyter-notebook
Bamboolib
bamboolib - a GUI for pandas DataFrames
Stars: ✭ 622 (-1.74%)
Mutual labels: jupyter-notebook
Tensorflow Workshop
This repo contains materials for use in a TensorFlow workshop.
Stars: ✭ 628 (-0.79%)
Mutual labels: jupyter-notebook
Machine Learning Book
《机器学习宝典》包含:谷歌机器学习速成课程(招式)+机器学习术语表(口诀)+机器学习规则(心得)+机器学习中的常识性问题 (内功)。该资源适用于机器学习、深度学习研究人员和爱好者参考!
Stars: ✭ 616 (-2.69%)
Mutual labels: jupyter-notebook
Ai Fundamentals
Code samples for AI fundamentals
Stars: ✭ 631 (-0.32%)
Mutual labels: jupyter-notebook
Fastai2
Temporary home for fastai v2 while it's being developed
Stars: ✭ 630 (-0.47%)
Mutual labels: jupyter-notebook
Tutorials
A series of machine learning tutorials for Torch7
Stars: ✭ 621 (-1.9%)
Mutual labels: jupyter-notebook
Anchor
Code for "High-Precision Model-Agnostic Explanations" paper
Stars: ✭ 629 (-0.63%)
Mutual labels: jupyter-notebook
Swift Models
Models and examples built with Swift for TensorFlow
Stars: ✭ 619 (-2.21%)
Mutual labels: jupyter-notebook
Kmcuda
Large scale K-means and K-nn implementation on NVIDIA GPU / CUDA
Stars: ✭ 627 (-0.95%)
Mutual labels: jupyter-notebook
Mining The Social Web 3rd Edition
The official online compendium for Mining the Social Web, 3rd Edition (O'Reilly, 2018)
Stars: ✭ 633 (+0%)
Mutual labels: jupyter-notebook
Bokeh Notebooks
Interactive Web Plotting with Bokeh in IPython notebook
Stars: ✭ 629 (-0.63%)
Mutual labels: jupyter-notebook
sklearn-deap
Use evolutionary algorithms instead of gridsearch in scikit-learn. This allows you to reduce the time required to find the best parameters for your estimator. Instead of trying out every possible combination of parameters, evolve only the combinations that give the best results.
Here is an ipython notebook comparing EvolutionaryAlgorithmSearchCV against GridSearchCV and RandomizedSearchCV.
It's implemented using deap library: https://github.com/deap/deap
Install
To install the library use pip:
pip install sklearn-deap
or clone the repo and just type the following on your shell:
python setup.py install
Usage examples
Example of usage:
import sklearn.datasets
import numpy as np
import random
data = sklearn.datasets.load_digits()
X = data["data"]
y = data["target"]
from sklearn.svm import SVC
from sklearn.model_selection import StratifiedKFold
paramgrid = {"kernel": ["rbf"],
"C" : np.logspace(-9, 9, num=25, base=10),
"gamma" : np.logspace(-9, 9, num=25, base=10)}
random.seed(1)
from evolutionary_search import EvolutionaryAlgorithmSearchCV
cv = EvolutionaryAlgorithmSearchCV(estimator=SVC(),
params=paramgrid,
scoring="accuracy",
cv=StratifiedKFold(n_splits=4),
verbose=1,
population_size=50,
gene_mutation_prob=0.10,
gene_crossover_prob=0.5,
tournament_size=3,
generations_number=5,
n_jobs=4)
cv.fit(X, y)
Output:
Types [1, 2, 2] and maxint [0, 24, 24] detected
--- Evolve in 625 possible combinations ---
gen nevals avg min max
0 50 0.202404 0.10128 0.962716
1 26 0.383083 0.10128 0.962716
2 31 0.575214 0.155259 0.962716
3 29 0.758308 0.105732 0.976071
4 22 0.938086 0.158041 0.976071
5 26 0.934201 0.155259 0.976071
Best individual is: {'kernel': 'rbf', 'C': 31622.776601683792, 'gamma': 0.001}
with fitness: 0.976071229827
Example for maximizing just some function:
from evolutionary_search import maximize
def func(x, y, m=1., z=False):
return m * (np.exp(-(x**2 + y**2)) + float(z))
param_grid = {'x': [-1., 0., 1.], 'y': [-1., 0., 1.], 'z': [True, False]}
args = {'m': 1.}
best_params, best_score, score_results, _, _ = maximize(func, param_grid, args, verbose=False)
Output:
best_params = {'x': 0.0, 'y': 0.0, 'z': True}
best_score = 2.0
score_results = (({'x': 1.0, 'y': -1.0, 'z': True}, 1.1353352832366128),
({'x': -1.0, 'y': 1.0, 'z': True}, 1.3678794411714423),
({'x': 0.0, 'y': 1.0, 'z': True}, 1.3678794411714423),
({'x': -1.0, 'y': 0.0, 'z': True}, 1.3678794411714423),
({'x': 1.0, 'y': 1.0, 'z': True}, 1.1353352832366128),
({'x': 0.0, 'y': 0.0, 'z': False}, 2.0),
({'x': -1.0, 'y': -1.0, 'z': False}, 0.36787944117144233),
({'x': 1.0, 'y': 0.0, 'z': True}, 1.3678794411714423),
({'x': -1.0, 'y': -1.0, 'z': True}, 1.3678794411714423),
({'x': 0.0, 'y': -1.0, 'z': False}, 1.3678794411714423),
({'x': 1.0, 'y': -1.0, 'z': False}, 1.1353352832366128),
({'x': 0.0, 'y': 0.0, 'z': True}, 2.0),
({'x': 0.0, 'y': -1.0, 'z': True}, 2.0))
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].