feat: add DataFrame.ai.forecast() support#1828
Conversation
bigframes/operations/ai.py
Outdated
| from bigframes.ml import core as ml_core | ||
|
|
||
| self._df: bigframes.dataframe.DataFrame = df | ||
| self._base_bqml = ml_core.BaseBqml(session=df._session) |
There was a problem hiding this comment.
Can you inject BaseBqml as a constructor parameter (default to None)? It might make testing easier if we want to fake/mock BaseBqml in the future.
| "confidence_level": confidence_level, | ||
| } | ||
| if id_columns: | ||
| options["id_cols"] = id_columns |
There was a problem hiding this comment.
Maybe we should verify the validity of timestamp_column and data_column, and raise error if necessary?
There was a problem hiding this comment.
You mean the data types? We rely on the checks from the backend. Basically client libraries shouldn't do too much checks unless those are only specific to client.
There was a problem hiding this comment.
No I meant the existence of these columns. If the user has made some typos, we want the code to fail fast. The other methods have this check too.
bigframes/operations/ai.py
Outdated
| from bigframes.ml import core as ml_core | ||
|
|
||
| self._df: bigframes.dataframe.DataFrame = df | ||
| self._base_bqml: ml_core.BaseBqml = base_bqml |
There was a problem hiding this comment.
Let's also provide a default BaseBqml instance if None is provided: It should be just ml_core.BaseBqml(df._session).
By doing this, we don't need to provide one in that dataframe ai property.
|
Thanks! |
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕