| from prophet import Prophet | |
| import numpy as np | |
| from sklearn.linear_model import LinearRegression | |
| class AdPredictor: | |
| def forecast_performance(self, historical_data): | |
| model = Prophet() | |
| model.fit(historical_data) | |
| future = model.make_future_dataframe(periods=30) | |
| return model.predict(future) | |
| def simulate_budget(self, current_spend, current_performance, proposed_spend): | |
| X = np.array([current_spend]).reshape(-1, 1) | |
| y = np.array([current_performance]) | |
| model = LinearRegression().fit(X, y) | |
| return model.predict([[proposed_spend]]) |