Metadata-Version: 2.1
Name: pybsts
Version: 1.0.7
Summary: Python interface to Bayesian Structured Time Series
Home-page: https://github.com/vitos555/BOOM
Author: Vitalii Ostrovskyi
Author-email: vitos@vitos.org.ua
License: LGPL 2.1
Description: 
        About PyBSTS
        ============
        
        PyBSTS is an adaptation of R's implementation of Steven L. Scott's 
        [BSTS library](https://cran.r-project.org/web/packages/bsts/). 
        It has similar interface, but re-written for Python memory model. 
        It is a Cython+Numpy based implementation and thus dependendecies for these packages.
        
        Package Contents
        ----------------
        
        PyBSTS package installs pybsts and causal_impact libraries. 
        
        Quick start
        -----------
        
        1. Install the package
        ```
        pip install pybsts
        ```
        
        2. Build BSTS model
        ```
        import pybsts
        import numpy as np
        
        y = np.array([1.0, 2.0, 3.0, 4.0, 4.5])
        
        specification = {"ar_order": 1, "local_trend": {"local_level": True},
                         "sigma_prior": np.std(y, ddof=1), "initial_value": y[0]}
        b = pybsts.PyBsts("gaussian", specification, {"ping": 10, "niter":100, "seed": 1, "burn": 10})
        b.fit(y, seed=1)
        res = b.predict(seed=1)
        print(res)
        
        y = np.array([1.0, 2.0, 3.0, 4.0, 4.5])
        X = np.array([[1.0, 2.0, 0.0, 0.0, 0.0], [0.0, 0.0, 3.0, 4.0, 0.0]])
        
        
        specification = {"local_trend": {"static_intercept": True},
                         "predictors_prior": {"predictors_squared_normalized": np.dot(X, X.T)/X.shape[1]},
                         "sigma_prior": np.std(y, ddof=1), "initial_value": y[0], "mean_value": np.mean(y), 
                         "predictor_names": ["first", "second"]}
        b = pybsts.PyBsts("gaussian", specification, 
                          {"ping": 10, "niter":100, "burn": 10, "forecast_horizon": 2, "seed": 1})
        b.fit(X.T, y, seed=1)
        res = b.predict(np.array([[1.0, 0.0], [2.0, 0.0]]), [6, 7], seed=1)
        print(res)
        ```
        
        3. Build CausalImpact model
        ```
        import causal_impact
        import numpy as np
        
        y = np.array([1.0, 2.0, 3.0, 4.0, 4.5, 3.5, 2.5, 2.6])
        X = np.array([[1.0, 2.0, 0.0, 0.0, 0.0, 3.5, 0.0, 0.0], [0.0, 0.0, 3.0, 4.0, 4.4, 0.0, 2.5, 2.5]])
                         
        b = causal_impact.CausalImpact(X, y, range(0, 5), range(6, 8), niter=1000, burn=100, seed=1, 
                                       seasons=[{"number_of_seasons": 3, "duration": 1}])
        res = b.analyze()
        print(res[0], res[1])
        print(b.summary())
        ```
        
        Current status
        --------------
        
        Here is a list of implemented models (see [BSTS Library Documentation](https://cran.r-project.org/web/packages/bsts/bsts.pdf) ):
        - stationary (non-dynamic) gaussian regression with local.level + seasons
        - stationary (non-dynamic) gaussian regression with local.linear.trend + seasons
        - stationary (non-dynamic) gaussian regression with semilocal.linear.trend + seasons
        - stationary (non-dynamic) gaussian regression with static.intercept + seasons
        - any of the above + ar
        - any of the above + auto.ar
        
Keywords: bsts,pybsts,bayesian time series,time series,prediction
Platform: UNKNOWN
Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
Requires-Python: >=3.6
Description-Content-Type: text/markdown
