GithubHelp home page GithubHelp logo

oryjonay / anytime-gridsearch Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 2.0 131 KB

An anytime implementation of scikit-learn GridSearchCV

License: MIT License

Python 93.24% HTML 2.13% Vue 0.43% JavaScript 3.06% CSS 0.77% Shell 0.18% Dockerfile 0.18%
anytime-algorithms gridsearchcv search-algorithm machine-learning

anytime-gridsearch's Introduction

AnyTimeGridSearchCV

An anytime implementation of scikit-learn GridSearchCV.

Build Status Coverage Status

Motivation

Waiting for GridSearchCV to finish running can be quite long, using an anytime approach will allow the algorithm to run in the background, with an endpoint to query for best result.

Brief overview

The project consists of the following parts:

  1. A web application for creating and displaying searches and results through a REST API
  2. A distributed cluster for running the searches

Installation

The project requires:

  • Python (>=3.6)
  • Django (>=2.1)
  • PostgreSQL (>=9.6)
  • distributed (>=1.25)
# clone repo
git clone https://github.com/OryJonay/anytime-gridsearch.git anytimegridsearch

# create virtual environment
cd anytimegridsearch
virtualenv -p python3.5 .

# install dependencies
pip install -r requirements.txt

# run tests
python manage.py test

Alternatively, use Docker Compose to run everything:

docker-compose up

And the web application will run on localhost (on port 8000).

Usage

The old way of using scikit-learn's GridSearchCV (taken from the examples part of the documentation):

from sklearn import svm, datasets
from sklearn.model_selection import GridSearchCV
iris = datasets.load_iris()
parameters = {'kernel':('linear', 'rbf'), 'C':[1, 10]}
svc = svm.SVC()
clf = GridSearchCV(svc, parameters)
clf.fit(iris.data, iris.target)
print clf.best_params_['kernel']

This will run all possible grid points (4 in this example), and only after all grid points are fitted and cross validated will return (and print the best kernel). We'll do it like this:

from sklearn import svm, datasets
from AnyTimeGridSearchCV.grids.anytime_search import AnyTimeGridSearchCV as GridSearchCV
iris = datasets.load_iris()
parameters = {'kernel':('linear', 'rbf'), 'C':[1, 10]}
svc = svm.SVC()
clf = GridSearchCV(svc, parameters)
clf.fit(iris.data, iris.target)
print clf.best_params_['kernel']

And that's (mostly) it- just change the search algorithm to the new one, and voilà- all done! The call to the search algorithm is non blocking, so it's possible to query the search algorithm before all the grid points are cross validated.

API DOCS

API documentation can be found on the web server at /docs/.

Roadmap

Things to do in the future (not sorted by priority):

  • Home page for project

anytime-gridsearch's People

Contributors

oryjonay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dorz11 pisike98

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.