-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforecasting.py
26 lines (22 loc) · 1.11 KB
/
forecasting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# forecasting.py
import numpy as np
from statsmodels.tsa.holtwinters import ExponentialSmoothing
from config import HISTORICAL_REVENUE, HISTORICAL_COSTS, HISTORICAL_OPERATING_EXPENSES, FORECAST_PERIOD
def forecast_revenue():
model = ExponentialSmoothing(HISTORICAL_REVENUE, trend='add', seasonal=None, damped_trend=True)
model_fit = model.fit()
forecast = model_fit.forecast(steps=FORECAST_PERIOD)
return forecast
def forecast_costs():
model = ExponentialSmoothing(HISTORICAL_COSTS, trend='add', seasonal=None, damped_trend=True)
model_fit = model.fit()
forecast = model_fit.forecast(steps=FORECAST_PERIOD)
return forecast
def forecast_operating_expenses():
model = ExponentialSmoothing(HISTORICAL_OPERATING_EXPENSES, trend='add', seasonal=None, damped_trend=True)
model_fit = model.fit()
forecast = model_fit.forecast(steps=FORECAST_PERIOD)
return forecast
def forecast_net_income(forecasted_revenue, forecasted_costs, forecasted_operating_expenses):
forecasted_net_income = forecasted_revenue - forecasted_costs - forecasted_operating_expenses
return forecasted_net_income