Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
americast committed Nov 7, 2023
1 parent 56a401a commit 7aab727
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 5 additions & 5 deletions docs/source/reference/ai/model-forecasting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ This trains a forecasting model. The model can be called by providing the horizo
SELECT Forecast();
.. note::

`Forecasting` function also provides suggestions by default. If you wish to turn it off, send `FALSE` as an optional argument while calling the function. Eg. `SELECT Forecast(FALSE);`
Forecast Parameters
-------------------
Expand Down Expand Up @@ -69,9 +66,12 @@ EvaDB's default forecast framework is `statsforecast <https://nixtla.github.io/s
* - FREQUENCY (str, default: 'auto')
- A string indicating the frequency of the data. The common used ones are D, W, M, Y, which respectively represents day-, week-, month- and year- end frequency. The default value is M. Check `pandas available frequencies <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`_ for all available frequencies. If it is not provided, the frequency is attempted to be determined automatically.
* - METRICS (str, default: 'True')
- Compute NRMSE by performing cross-validation. It is `False` by default if `LIBRARY` is `neuralforecast` as it can take an extensively long time.
- Compute NRMSE by performing cross-validation. It is `False` by default if `LIBRARY` is `neuralforecast` as it can take an extensively long time. The metrics are logged locally.

.. note::

Note: If columns other than the ones required as mentioned above are passed while creating the function, they will be treated as exogenous variables if LIBRARY is `neuralforecast`. Otherwise, they would be ignored.
Note: If columns other than the ones required as mentioned above are passed while creating the function, they will be treated as exogenous variables if LIBRARY is `neuralforecast`. Otherwise, they would be ignored.
`Forecasting` function also logs suggestions. Logged information, such as metrics and suggestions, is sent to STDOUT by default. If you wish not to print it, please send `FALSE` as an optional argument while calling the function. Eg. `SELECT Forecast(FALSE);`

Below is an example query specifying the above parameters:

Expand Down
9 changes: 6 additions & 3 deletions evadb/functions/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def setup(
self.hypers = "p,d,q: " + f.readline()

def forward(self, data) -> pd.DataFrame:
log_str = ""
if self.library == "statsforecast":
forecast_df = self.model.predict(
h=self.horizon, level=[self.conf]
Expand All @@ -92,13 +93,15 @@ def forward(self, data) -> pd.DataFrame:
suggestion_list.append(1)

for suggestion in set(suggestion_list):
print("\nSUGGESTION: " + self.suggestion_dict[suggestion])
log_str += "\nSUGGESTION: " + self.suggestion_dict[suggestion]

# Metrics
if self.rmse is not None:
print("\nMean normalized RMSE: " + str(self.rmse))
log_str += "\nMean normalized RMSE: " + str(self.rmse)
if self.hypers is not None:
print("Hyperparameters: " + self.hypers)
log_str += "\nHyperparameters: " + self.hypers

print(log_str)

forecast_df = forecast_df.rename(
columns={
Expand Down

0 comments on commit 7aab727

Please sign in to comment.