mirror of
https://github.com/Sosokker/HomieCare.git
synced 2025-12-19 02:04:03 +01:00
Add xgboost regression class
This commit is contained in:
parent
e2c1097ba5
commit
86e420bd0a
19
StreamServer/src/analytic/health/indoor_model.py
Normal file
19
StreamServer/src/analytic/health/indoor_model.py
Normal file
@ -0,0 +1,19 @@
|
||||
import joblib
|
||||
|
||||
|
||||
class XgboostIndoorModel:
|
||||
MODEL_PATH = 'xgboost_model.pkl'
|
||||
|
||||
def __init__(self):
|
||||
self.__model = joblib.load(self.MODEL_PATH)
|
||||
|
||||
def predict(self, X: list) -> float:
|
||||
"""
|
||||
Predict the indoor temperature based on the input features
|
||||
Input order : ['outdoor_temp', 'outdoor_feels_like', 'outdoor_pressure',
|
||||
'outdoor_humidity', 'outdoor_pm25', 'outdoor_pm10']
|
||||
"""
|
||||
if len(X) != 6:
|
||||
raise ValueError(f"Expected 6 features, got {len(X)}")
|
||||
|
||||
return self.__model.predict([X])[0]
|
||||
Loading…
Reference in New Issue
Block a user