From 68f3565c5b244f9e5d80075eb7fe942fe826ab5b Mon Sep 17 00:00:00 2001 From: ghadialhajj Date: Fri, 26 Jan 2024 11:28:52 +0100 Subject: [PATCH] Add initial poisson predictor --- climate_health/predictor/poisson.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 climate_health/predictor/poisson.py diff --git a/climate_health/predictor/poisson.py b/climate_health/predictor/poisson.py new file mode 100644 index 00000000..9928a473 --- /dev/null +++ b/climate_health/predictor/poisson.py @@ -0,0 +1,19 @@ +from climate_health.predictor.protocol import Predictor +import sklearn.linear_model as lm + + +class Poisson(): + def __init__(self, alpha=1, fit_intercept=True): + self.model = lm.PoissonRegressor(alpha=alpha, fit_intercept=fit_intercept) + + def predict(self, data): + self.model.predict(data) + + def evaluate(self, data): + self.model.score(data, data) + + def train(self, data): + self.model.fit(data) + +# def evaluate(predictor: Predictor, data): +# return predictor.evaluate(data)