Skip to content

Commit

Permalink
Fixed issues pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EL HANI Marwane committed Nov 28, 2024
1 parent 1850eff commit 286660b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions river/model_selection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
from . import base
from .bandit import BanditClassifier, BanditRegressor
from .greedy import GreedyRegressor
from .hoeffding_races import HoeffdingRaceClassifier
from .hoeffding_races import HoeffdingRaceRegressor
from .hoeffding_races import HoeffdingRaceClassifier, HoeffdingRaceRegressor
from .sh import SuccessiveHalvingClassifier, SuccessiveHalvingRegressor

__all__ = [
Expand All @@ -30,5 +29,5 @@
"SuccessiveHalvingClassifier",
"SuccessiveHalvingRegressor",
"HoeffdingRaceClassifier",
"HoeffdingRaceRegressor"
"HoeffdingRaceRegressor",
]
9 changes: 4 additions & 5 deletions river/model_selection/hoeffding_races.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,16 @@ def learn_one(self, x, y):
break

def predict_one(self, x):

if len(self.remaining_models) == 1:
return self.models[list(self.remaining_models)[0]].predict_one(x)
return None
return None

def single_model_remaining(self):
return len(self.remaining_models) == 1


class HoeffdingRaceRegressor(base.Regressor):
"""
"""
HoeffdingRace-based model selection for regression.
Each models is associated to a performance (here its accuracy). When the model is considered too inaccurate by the hoeffding bound,
Expand Down Expand Up @@ -124,7 +123,7 @@ class HoeffdingRaceRegressor(base.Regressor):
...
>>> print(hoeffding_race.remaining_models)
['Log_Reg']
"""

def __init__(
Expand Down Expand Up @@ -165,7 +164,7 @@ def learn_one(self, x, y):
def predict_one(self, x):
if len(self.remaining_models) == 1:
return self.models[list(self.remaining_models)[0]].predict_one(x)
return None
return None

def single_model_remaining(self):
"""
Expand Down

0 comments on commit 286660b

Please sign in to comment.