Skip to content

alvarouc/mlp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keras Multilayer Perceptron for scikit-learn

Keras makes it very easy to implement deep-learning models, however these are not compatible with scikit-learn out-of-the-box. This prohibits our models to be tested using sciki-learn's methods GridSearchCV and cross_val_score.

I created this MLP class to be compatible with scikit-learn that contains the fit, predict, and predict_proba methods.

Install

pip install mlp

Quick guide

Initialize your classifier

from mlp import MLP
clf = MLP(n_hidden=10, n_deep=3, l1_norm=0, drop=0.1, verbose=0)

Now evaluate your classifier with scikit-learn's cross_val_score

from sklearn.cross_validation import cross_val_score
scores = cross_val_score(clf, data, label, cv=5, n_jobs=-1, scoring='f1_weighted')
print(scores)

See a complete example in https://github.com/alvarouc/mlp/blob/master/examples/moon_sklearn.ipynb

About

Multilayer Perceptron Keras wrapper for sklearn

Resources

License

Stars

Watchers

Forks

Packages

No packages published