Skip to content

Commit

Permalink
Rename combiners to fuzers
Browse files Browse the repository at this point in the history
  • Loading branch information
bgulowaty committed Nov 26, 2019
1 parent 61b0626 commit 81a392c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
8 changes: 4 additions & 4 deletions strlearn/ensembles/OALE.py
Expand Up @@ -10,8 +10,8 @@
from strlearn.base import ClassifierSupplier
from strlearn.base.exceptions import BaseClassifierDoesNotSupportPartialFitting
from strlearn.base.types import Classifier
from strlearn.ensembles.voting.SupportsExtractor import SupportsExtractor
from strlearn.ensembles.voting.WeightedMajorityPredictionCombiner import WeightedMajorityPredictionCombiner
from strlearn.ensembles.fuzers.SupportsExtractor import SupportsExtractor
from strlearn.ensembles.fuzers.WeightedMajorityFuzer import WeightedMajorityFuzer


@attrs(auto_attribs=True)
Expand Down Expand Up @@ -92,7 +92,7 @@ def predict(self, x):

ensemble, weights = self._get_compact_ensemble_with_weights()

return WeightedMajorityPredictionCombiner(
return WeightedMajorityFuzer(
ensemble=ensemble,
weights=weights,
classes=self._classes) \
Expand All @@ -103,7 +103,7 @@ def predict_proba(self, x):

ensemble, weights = self._get_compact_ensemble_with_weights()

return WeightedMajorityPredictionCombiner(
return WeightedMajorityFuzer(
ensemble=ensemble,
weights=weights,
classes=self._classes) \
Expand Down
Expand Up @@ -2,14 +2,13 @@

import numpy as np
from attr import attrs
from sklearn.base import BaseEstimator
from sklearn.preprocessing import normalize

from strlearn.base.types import Classifier


@attrs(auto_attribs=True, frozen=True)
class SupportsExtractor:
_ensemble: List[Classifier] = None
_ensemble: List[BaseEstimator] = None
_weights: List[int] = None
_classes: List = None
_normalized: bool = False
Expand Down
@@ -1,16 +1,19 @@
from typing import List

import numpy as np
from attr import attrs, attrib
from sklearn.base import BaseEstimator
from sklearn.utils import check_array

from strlearn.ensembles.voting.SupportsExtractor import SupportsExtractor
from strlearn.ensembles.voting.api.BaseEnsemblePredictionCombiner import BaseEnsemblePredictionCombiner
from strlearn.ensembles.fuzers.SupportsExtractor import SupportsExtractor
from strlearn.ensembles.fuzers.api.BaseEnsemblePredictionFuzer import BaseEnsemblePredictionFuzer


@attrs
class WeightedMajorityPredictionCombiner(BaseEnsemblePredictionCombiner):
_ensemble = attrib()
_weights = attrib()
_classes = attrib()
@attrs(auto_attribs=True)
class WeightedMajorityFuzer(BaseEnsemblePredictionFuzer):
_ensemble: List[BaseEstimator] = attrib()
_weights: List[float] = attrib()
_classes: List = attrib()

def get_supports(self, x):
return SupportsExtractor(self._ensemble, self._weights, self._classes).extract(x)
Expand Down
File renamed without changes.
@@ -1,7 +1,7 @@
from abc import ABCMeta, abstractmethod


class BaseEnsemblePredictionCombiner(metaclass=ABCMeta):
class BaseEnsemblePredictionFuzer(metaclass=ABCMeta):

@abstractmethod
def predict(self, x):
Expand Down
File renamed without changes.

0 comments on commit 81a392c

Please sign in to comment.