5 changed files with 0 additions and 53 deletions
@ -1,16 +0,0 @@ |
|||
import pandas as pd # type: ignore |
|||
|
|||
from ..interfaces import Predictor |
|||
|
|||
|
|||
class MeanAggregator(Predictor): |
|||
"""Aggregate multiples predictors.""" |
|||
|
|||
def __init__(self, predictors): |
|||
"""Initialize MeanAggregator.""" |
|||
self.predictors = predictors |
|||
|
|||
def predict(self, data: pd.DataFrame) -> dict: |
|||
"""Predict from others predictors.""" |
|||
preds = [cls.predict(data) for cls in self.predictors] |
|||
return pd.DataFrame(preds).mean().to_dict() |
@ -1,11 +0,0 @@ |
|||
import pandas as pd # type: ignore |
|||
|
|||
from ..interfaces import Predictor |
|||
|
|||
|
|||
class NormalizedPredictor(Predictor): |
|||
def predict(self, data: pd.DataFrame) -> dict: |
|||
"""It's just random""" |
|||
df = data.iloc[-1] |
|||
df = df/df.sum() |
|||
return df.to_dict() |
@ -1,13 +0,0 @@ |
|||
from random import random |
|||
import pandas as pd # type: ignore |
|||
|
|||
from ..interfaces import Predictor |
|||
|
|||
|
|||
class RandomPredictor(Predictor): |
|||
def predict(self, data: pd.DataFrame) -> dict: |
|||
"""It's just random""" |
|||
return { |
|||
k: random()*2-1 |
|||
for k in data.columns |
|||
} |
@ -1,13 +0,0 @@ |
|||
import pandas as pd # type: ignore |
|||
|
|||
from ..interfaces import Predictor |
|||
|
|||
|
|||
class SelectorPredictor(Predictor): |
|||
|
|||
def __init__(self, to_return) -> None: |
|||
self.to_return = to_return |
|||
|
|||
def predict(self, data: pd.DataFrame) -> dict: |
|||
"""It's just random""" |
|||
return {**{k:0 for k in data.to_dict().keys()}, **self.to_return} |
Loading…
Reference in new issue