models.py 781 B

12345678910111213141516171819202122232425262728
  1. # Copyright (c) 2017-present, Facebook, Inc.
  2. # All rights reserved.
  3. #
  4. # This source code is licensed under the BSD-style license found in the
  5. # LICENSE file in the root directory of this source tree. An additional grant
  6. # of patent rights can be found in the PATENTS file in the same directory.
  7. from __future__ import absolute_import
  8. from __future__ import division
  9. from __future__ import print_function
  10. from __future__ import unicode_literals
  11. import pickle
  12. import pkg_resources
  13. def get_prophet_stan_model():
  14. """Load compiled Stan model"""
  15. model_file = pkg_resources.resource_filename(
  16. 'fbprophet',
  17. 'stan_model/prophet_model.pkl',
  18. )
  19. with open(model_file, 'rb') as f:
  20. return pickle.load(f)
  21. prophet_stan_model = get_prophet_stan_model()