bigfunctions > prophet_table
prophet_table¶
Call or Deploy prophet_table
?
✅ You can call this prophet_table
bigfunction directly from your Google Cloud Project (no install required).
- This
prophet_table
function is deployed inbigfunctions
GCP project in 39 datasets for all of the 39 BigQuery regions. You need to use the dataset in the same region as your datasets (otherwise you may have a function not found error). - Function is public, so it can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
- You may prefer to deploy the BigFunction in your own project if you want to build and manage your own catalog of functions. This is particularly useful if you want to create private functions (for example calling your internal APIs). Discover the framework
Public BigFunctions Datasets:
Region | Dataset |
---|---|
eu |
bigfunctions.eu |
us |
bigfunctions.us |
europe-west1 |
bigfunctions.europe_west1 |
asia-east1 |
bigfunctions.asia_east1 |
... | ... |
Description¶
Signature
prophet_table(records, periods, kwargs)
Description
Return Time Series Forecast as table using prophet python library.
Parameters of this function are passed as is to prophet python function and python function result is returned as is.
(Inspired from this Felipe Hoffa medium's post)
Examples¶
1. Using a table with columns named ds
and y
for date and value respectively
with sample_data as (
select date('2022-01-01') as ds, 1 as y,
union all
select date('2022-01-02') as ds, 2 as y,
)
select * from bigfunctions.eu.prophet_table(
to_json((
select array_agg(sample_data)
from sample_data
))
, 3, null)
with sample_data as (
select date('2022-01-01') as ds, 1 as y,
union all
select date('2022-01-02') as ds, 2 as y,
)
select * from bigfunctions.us.prophet_table(
to_json((
select array_agg(sample_data)
from sample_data
))
, 3, null)
with sample_data as (
select date('2022-01-01') as ds, 1 as y,
union all
select date('2022-01-02') as ds, 2 as y,
)
select * from bigfunctions.europe_west1.prophet_table(
to_json((
select array_agg(sample_data)
from sample_data
))
, 3, null)
| -------------------------------------|
| date | yhat | yhat_lower | ... |
| -------------------------------------|
| 2022-01-03 | 3 | 3 | ... |
| 2022-01-04 | 4 | 4 | ... |
| 2022-01-05 | 5 | 5 | ... |
| -------------------------------------|
2. Using a table with columns to rename to ds
and y
with sample_data as (
select date('2022-01-01') as date, 1 as value,
union all
select date('2022-01-02') as date, 2 as value,
)
select * from bigfunctions.eu.prophet_table(
to_json((
select array_agg(struct(date as ds, value as y))
from sample_data
))
, 3, null)
with sample_data as (
select date('2022-01-01') as date, 1 as value,
union all
select date('2022-01-02') as date, 2 as value,
)
select * from bigfunctions.us.prophet_table(
to_json((
select array_agg(struct(date as ds, value as y))
from sample_data
))
, 3, null)
with sample_data as (
select date('2022-01-01') as date, 1 as value,
union all
select date('2022-01-02') as date, 2 as value,
)
select * from bigfunctions.europe_west1.prophet_table(
to_json((
select array_agg(struct(date as ds, value as y))
from sample_data
))
, 3, null)
| -------------------------------------|
| date | yhat | yhat_lower | ... |
| -------------------------------------|
| 2022-01-03 | 3 | 3 | ... |
| 2022-01-04 | 4 | 4 | ... |
| 2022-01-05 | 5 | 5 | ... |
| -------------------------------------|
Need help using prophet_table
?
The community can help! Engage the conversation on Slack
For professional suppport, don't hesitate to chat with us.
Found a bug using prophet_table
?
If the function does not work as expected, please
- report a bug so that it can be improved.
- or open the discussion with the community on Slack.
For professional suppport, don't hesitate to chat with us.
Spread the word¶
BigFunctions is fully open-source. Help make it a success by spreading the word!