2018-12-20 23:33:23 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2017-04-14 06:23:44 +00:00
|
|
|
# Copyright (c) 2017-present, Facebook, Inc.
|
|
|
|
|
# All rights reserved.
|
|
|
|
|
#
|
|
|
|
|
# This source code is licensed under the BSD-style license found in the
|
2017-09-26 00:34:27 +00:00
|
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
2017-04-14 06:23:44 +00:00
|
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
|
|
2018-12-20 23:33:23 +00:00
|
|
|
from __future__ import absolute_import, division, print_function
|
2017-04-14 06:23:44 +00:00
|
|
|
|
|
|
|
|
import pickle
|
2018-12-20 23:33:23 +00:00
|
|
|
|
2017-04-14 06:23:44 +00:00
|
|
|
import pkg_resources
|
2017-05-04 00:06:20 +00:00
|
|
|
|
2017-04-14 06:23:44 +00:00
|
|
|
|
2018-05-04 23:04:29 +00:00
|
|
|
def get_prophet_stan_model():
|
2017-04-14 06:23:44 +00:00
|
|
|
"""Load compiled Stan model"""
|
|
|
|
|
model_file = pkg_resources.resource_filename(
|
|
|
|
|
'fbprophet',
|
2018-05-04 23:04:29 +00:00
|
|
|
'stan_model/prophet_model.pkl',
|
2017-04-14 06:23:44 +00:00
|
|
|
)
|
|
|
|
|
with open(model_file, 'rb') as f:
|
|
|
|
|
return pickle.load(f)
|
|
|
|
|
|
2017-05-04 00:06:20 +00:00
|
|
|
|
2018-05-04 23:04:29 +00:00
|
|
|
prophet_stan_model = get_prophet_stan_model()
|