Module Import alias identifier ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body If Call AttributeLoad NameLoad attr NameLoad body Return TupleLoad Call NameLoad ListLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad Assign NameStore AttributeLoad NameLoad attr Assign ListStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword NameLoad Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore Dict Assign NameStore ListComp Call AttributeLoad NameLoad attr NameLoad NameLoad comprehension NameStore AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad IfExp CompareIn NameLoad NameLoad BinOpAdd SubscriptLoad NameLoad Index NameLoad ListLoad NameLoad ListLoad NameLoad Assign NameStore Call NameLoad ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr keyword NameLoad If CompareEq Call NameLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index Num Num body Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index Num Index Num Return TupleLoad Call NameLoad ListLoad SubscriptLoad NameLoad Index NameLoad NameLoad Assign NameStore NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign NameStore ListComp Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr NameLoad comprehension NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq NameLoad NameLoad body For NameStore Call NameLoad Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad IfExp CompareIn NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr CompareEq NameLoad SubscriptLoad NameLoad Index NameLoad attr Assign NameStore Call NameLoad NameLoad If CompareEq NameLoad Num body Return TupleLoad Call NameLoad ListLoad SubscriptLoad NameLoad Index Call AttributeLoad NameLoad attr CompareEq NameLoad NameLoad NameLoad orelse If CompareEq NameLoad NameLoad body Assign NameStore NameLoad Return TupleLoad Call NameLoad ListLoad SubscriptLoad NameLoad Index Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam defaults body If Call AttributeLoad NameLoad attr NameLoad body Return TupleLoad Call NameLoad ListLoad SubscriptLoad AttributeLoad NameLoad attr Index Num NameLoad Assign NameStore AttributeLoad NameLoad attr Assign ListStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword NameLoad Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListComp Call AttributeLoad NameLoad attr NameLoad NameLoad comprehension NameStore NameLoad Return TupleLoad Call NameLoad ListLoad SubscriptLoad NameLoad Index Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list
N/A N/A numpy np brew.base Ensemble base DCS OLA N/A DCS N/A N/A Overall Local Accuracy.

    The Overall Local Accuracy selects the best classifier for
    a sample using it's K nearest neighbors.

    Attributes
    ----------
    `Xval` : array-like, shape = [indeterminated, n_features]
        Validation set.

    `yval` : array-like, shape = [indeterminated]
        Labels of the validation set.

    `knn`  : sklearn KNeighborsClassifier,
        Classifier used to find neighborhood.


    Examples
    --------
    >>> from brew.selection.dynamic.ola import OLA
    >>> from brew.generation.bagging import Bagging
    >>> from brew.base import EnsembleClassifier
    >>>
    >>> from sklearn.tree import DecisionTreeClassifier
    >>> import numpy as np
    >>>
    >>> X = np.array([[-1, 0], [-0.8, 1], [-0.8, -1], [-0.5, 0] , [0.5, 0], [1, 0], [0.8, 1], [0.8, -1]])
    >>> y = np.array([1, 1, 1, 2, 1, 2, 2, 2])
    >>>
    >>> bag = Bagging(base_classifier=DecisionTreeClassifier(max_depth=1, min_samples_leaf=1), n_classifiers=10)
    >>> bag.fit(X, y)
    >>>
    >>> ola = OLA(X, y, K=3)
    >>>
    >>> clf = EnsembleClassifier(bag.ensemble, selector=ola)
    >>> clf.predict([-1.1,-0.5])
    [1]

    See also
    --------
    brew.selection.dynamic.lca.LCA: Local Class Accuracy.

    References
    ----------
    Woods, Kevin, Kevin Bowyer, and W. Philip Kegelmeyer Jr. "Combination 
    of multiple classifiers using local accuracy estimates." Computer Vision 
    and Pattern Recognition, 1996. Proceedings CVPR'96, 1996 IEEE Computer 
    Society Conference on. IEEE, 1996.

    Ko, Albert HR, Robert Sabourin, and Alceu Souza Britto Jr. 
    "From dynamic classifier selection to dynamic ensemble selection." 
    Pattern Recognition 41.5 (2008): 1718-1731.
     select N/A N/A self ensemble x N/A N/A N/A N/A N/A ensemble in_agreement x N/A N/A N/A N/A Ensemble N/A N/A N/A ensemble classifiers N/A 0 None N/A classifiers N/A ensemble classifiers N/A N/A idx N/A N/A N/A self knn kneighbors x return_distance False N/A N/A X y N/A N/A N/A self Xval N/A idx N/A N/A self yval N/A idx N/A d N/A N/A scores N/A N/A N/A clf score X y N/A clf N/A ensemble classifiers N/A N/A i scr N/A enumerate scores N/A N/A N/A d N/A scr N/A N/A scr d N/A N/A d N/A scr N/A i N/A i N/A best_scores N/A sorted N/A k N/A k N/A N/A d iterkeys reverse True N/A N/A N/A len N/A d N/A N/A best_scores N/A 0 1 N/A N/A i N/A N/A d N/A N/A best_scores N/A 0 N/A 0 N/A N/A N/A Ensemble N/A N/A classifiers N/A i None N/A options None N/A N/A j score N/A enumerate best_scores N/A N/A pred N/A N/A N/A N/A classifiers N/A i predict x N/A i N/A d N/A score N/A pred N/A N/A N/A N/A np asarray pred flatten N/A bincount N/A N/A np bincount pred N/A N/A options None N/A N/A i N/A range N/A len bincount N/A N/A N/A bincount N/A i N/A N/A i options N/A bincount N/A i 0 N/A imx N/A N/A np argmax bincount N/A votes N/A N/A N/A N/A np argwhere N/A bincount N/A bincount N/A imx flatten N/A count N/A len votes N/A N/A count 1 N/A N/A N/A N/A Ensemble N/A N/A classifiers N/A N/A N/A np argmax N/A pred imx None N/A N/A N/A options None N/A N/A options votes N/A N/A N/A Ensemble N/A N/A classifiers N/A N/A N/A np argmax scores None N/A N/A OLA2 N/A DCS N/A select N/A N/A self ensemble x N/A N/A N/A N/A N/A ensemble in_agreement x N/A N/A N/A N/A Ensemble N/A N/A N/A ensemble classifiers N/A 0 None N/A classifiers N/A ensemble classifiers N/A N/A idx N/A N/A N/A self knn kneighbors x return_distance False N/A N/A X y N/A N/A N/A self Xval N/A idx N/A N/A self yval N/A idx N/A scores N/A N/A np asarray N/A N/A N/A clf score X y N/A clf classifiers N/A N/A N/A Ensemble N/A N/A classifiers N/A N/A N/A np argmax scores None N/A N/A