class LGBMModel: def __init__(self, num_leaves, n_estimators): self.model = lgb.LGBMRegressor( num_leaves=num_leaves, n_estimators=n_estimators ) def fit(self, X, y): self.model.fit(X, y) self.model.booster_.save_model('model/lgbm_model.txt') return self def predict(self, X): predictions = self.model.predict(X) return predictions