This service uses Prophet and Statsmodel to forecast points of a given time series.
It is part of our Time Series Analysis Services.
Clone this repository:
$ git clone https://github.com/singnet/time-series-analysis.git
$ cd generic/fbprophet-forecast
To get the ORGANIZATION_ID
and SERVICE_ID
you must have already published a service (check this link).
Create the SNET Daemon
's config JSON file (snetd.config.json
).
{
"DAEMON_END_POINT": "DAEMON_HOST:DAEMON_PORT",
"IPFS_END_POINT": "http://ipfs.singularitynet.io:80",
"BLOCKCHAIN_NETWORK_SELECTED": "BLOCKCHAIN_NETWORK",
"PASSTHROUGH_ENDPOINT": "http://SERVICE_GRPC_HOST:SERVICE_GRPC_PORT",
"ORGANIZATION_ID": "ORGANIZATION_ID",
"SERVICE_ID": "SERVICE_ID",
"LOG": {
"LEVEL": "debug",
"OUTPUT": {
"TYPE": "stdout"
}
}
}
For example (using the Ropsten testnet):
$ cat snetd.config.json
{
"DAEMON_END_POINT": "0.0.0.0:7042",
"IPFS_END_POINT": "http://ipfs.singularitynet.io:80",
"BLOCKCHAIN_NETWORK_SELECTED": "ropsten",
"PASSTHROUGH_ENDPOINT": "http://localhost:7003",
"ORGANIZATION_ID": "snet",
"SERVICE_ID": "fbprophet-forecast",
"LOG": {
"LEVEL": "debug",
"OUTPUT": {
"TYPE": "stdout"
}
}
}
Note that we set DAEMON_HOST = 0.0.0.0
because this service will run inside a Docker container.
Install all dependencies:
$ pip3 install -r requirements.txt
Generate the gRPC codes:
$ sh buildproto.sh
Start the service and SNET Daemon
:
$ python3 run_service.py
Inputs:
url
: A CSV file URL (withds
andy
headers).ds
: the date series if nourl
(max: 3000
).y
: the data series if nourl
(max: 3000
).period
: the Season-Trend period (optional
).points
: Number of points to forecast (max: 500
).
Note: The length of ds
and y
must be the same and greater then 100.
Local (testing purpose):
$ python3 test_service.py
Endpoint (localhost:7003):
Method (forecast):
CSV (URL): https://bh.singularitynet.io:7000/Resources/example_wp_log_peyton_manning.csv
Period (10):
Points (100): 365
response:
len(response.observed): 2905
len(response.seasonal): 2905
len(response.forecast): 3270
for further instructions about the output of this service, check the User's Guide.
Through SingularityNET (follow this link to learn how to publish a service and open a payment channel to be able to call it):
Assuming that you have an open channel (id: 0
) to this service:
$ snet client call fbprophet-forecast forecast '{"url": "https://bh.singularitynet.io:7000/Resources/example_wp_log_peyton_manning.csv"}'
observed: [ ... ]
trend: [ ... ]
seasonal: [ ... ]
forecast: [ ... ]
forecast_ds: [ ... ]
forecast_lower: [ ... ]
forecast_upper: [ ... ]
Please read our guidelines before submitting an issue. If your issue is a bug, please use the bug template pre-populated here. For feature requests and queries you can use this template.
- Artur Gontijo - Maintainer - SingularityNET