Skip to content

Commit

Permalink
readme and ewa changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bhargavvader committed Jul 27, 2017
1 parent a02e2f8 commit 48e01da
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

## pycobra

pycobra is a python library which serves as a toolkit for regression, prediction, and visualisation. In particular, pycobra implements aggregation (a.k.a ensemble) techniques. It is scikit-learn compatible and fits into the existing scikit-learn eco-system.
pycobra is a python library for ensemble learning, which serves as a toolkit for regression, classification, and visualisation. It is scikit-learn compatible and fits into the existing scikit-learn ecosystem.

pycobra offers a python implementation of the COBRA algorithm introduced by Biau et al. (2016) for regression ([paper](http://www.sciencedirect.com/science/article/pii/S0047259X15000950)).
pycobra offers a python implementation of the COBRA algorithm introduced by Biau et al. (2016) for regression.

Another algorithm implemented is the EWA (Exponentially Weighted Aggregate) aggregation technique (among several other references, you can check the [paper](http://www.crest.fr/ckfinder/userfiles/files/pageperso/tsybakov/DTcolt2007.pdf) by Dalayan and Tsybakov (2007).
Another algorithm implemented is the EWA (Exponentially Weighted Aggregate) aggregation technique (among several other references, you can check the paper by Dalalyan and Tsybakov (2007).

Apart from these two regression aggregation algorithms, pycobra implements a version of COBRA for classification. This procedure has been introduced by Mojirsheibani (1999) ([paper](http://www.tandfonline.com/doi/abs/10.1080/01621459.1999.10474154)).

pycobra also offers various visualisation and diagnostic methods built on top of matplotlib which lets the user analyse and compare different regression machines with COBRA.
The Visualisation class also lets you use some of the tools (such as Voronoi Tesselations) on other visualisation problems, such as clustering.
Apart from these two regression aggregation algorithms, pycobra implements a version of COBRA for classification. This procedure has been introduced by Mojirsheibani (1999).

pycobra also offers various visualisation and diagnostic methods built on top of matplotlib which lets the user analyse and compare different regression machines with COBRA. The Visualisation class also lets you use some of the tools (such as Voronoi Tesselations) on other visualisation problems, such as clustering.

### Documentation and Examples

Expand Down
2 changes: 1 addition & 1 deletion pycobra/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from pycobra.classifiercobra import ClassifierCobra

import math

import logging

logger = logging.getLogger('pycobra.diagnostics')
Expand Down Expand Up @@ -425,6 +424,7 @@ def optimal_machines_grid(self, X, y, line_points=200, info=False):
opt = min(MSE, key=MSE.get)
return opt, MSE[opt]


def optimal_beta(self, X, y, betas=None, info=False):
"""
Find the optimal beta value for the Ewa predictor.
Expand Down
6 changes: 5 additions & 1 deletion pycobra/ewa.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import math
import numpy as np
import random
import logging

logger = logging.getLogger('pycobra.ewa')

class Ewa(BaseEstimator):
"""
Expand Down Expand Up @@ -54,12 +56,13 @@ def __init__(self, random_state=None, beta=None, X_beta=None, y_beta=None, betas

if self.beta is None and X_beta is not None:
if betas is None:
betas = [0.1, 0.2, 0.5, 1]
betas = [0.001, 0.01, 0.1, 1.0, 10.0, 100.0]
tuned_parameters = [{'beta': betas}]
clf = GridSearchCV(self, tuned_parameters, cv=5, scoring="neg_mean_squared_error")
clf.fit(X_beta, y_beta)
self.beta = clf.best_params_["beta"]


def fit(self, X, y, default=True, X_k=None, X_l=None, y_k=None, y_l=None):
"""
Parameters
Expand Down Expand Up @@ -236,6 +239,7 @@ def predict(self, X):

return result


def plot_machine_weights(self, figsize=8):
"""
Plot each machine weights
Expand Down
2 changes: 1 addition & 1 deletion pycobra/visualisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import logging


logger = logging.getLogger('pycobra.visualisations')
logger = logging.getLogger('pycobra.visualisation')

def create_labels(indice_info):
"""
Expand Down

0 comments on commit 48e01da

Please sign in to comment.