From 48e01da498d5f310830d0ba54962569bd1eb7f87 Mon Sep 17 00:00:00 2001 From: Bhargav Srinivasa Date: Thu, 27 Jul 2017 11:36:53 +0200 Subject: [PATCH] readme and ewa changes --- README.md | 12 +++++------- pycobra/diagnostics.py | 2 +- pycobra/ewa.py | 6 +++++- pycobra/visualisation.py | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5918b60..08d95af 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pycobra/diagnostics.py b/pycobra/diagnostics.py index 7659121..2377d58 100644 --- a/pycobra/diagnostics.py +++ b/pycobra/diagnostics.py @@ -9,7 +9,6 @@ from pycobra.classifiercobra import ClassifierCobra import math - import logging logger = logging.getLogger('pycobra.diagnostics') @@ -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. diff --git a/pycobra/ewa.py b/pycobra/ewa.py index 190ab7d..eb14f9c 100644 --- a/pycobra/ewa.py +++ b/pycobra/ewa.py @@ -14,7 +14,9 @@ import math import numpy as np import random +import logging +logger = logging.getLogger('pycobra.ewa') class Ewa(BaseEstimator): """ @@ -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 @@ -236,6 +239,7 @@ def predict(self, X): return result + def plot_machine_weights(self, figsize=8): """ Plot each machine weights diff --git a/pycobra/visualisation.py b/pycobra/visualisation.py index d21b671..5c93bd0 100644 --- a/pycobra/visualisation.py +++ b/pycobra/visualisation.py @@ -22,7 +22,7 @@ import logging -logger = logging.getLogger('pycobra.visualisations') +logger = logging.getLogger('pycobra.visualisation') def create_labels(indice_info): """