Metadata-Version: 2.1
Name: cyclicmodel
Version: 0.0.1
Summary: statistical causality discovery based on cyclic model
Home-page: https://github.com/inoueakimitsu/cyclicmodel
Author: Akimitsu INOUE
Author-email: akimitsu.inoue@gmail.com
License: MIT License
Requires-Dist: theano
Requires-Dist: numpy
Requires-Dist: pymc3

Copyright (c) 2018 Akimitsu INOUE and Shohei SHIMIZU

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Description: # cyclicmodel
        Statistical causal discovery based on cyclic model
        
        ## Summary
        Python package that performs statistical causal discovery
        under the following condition:
        1. there are unobserved common factors
        2. two-way causal relationship exists
        
        `cyclicmodel` has been developed based on
        [`bmlingam`][4670f282], which implemented bayesian mixed LiNGAM.
        
          [4670f282]: https://github.com/taku-y/bmlingam "bmlingam"
        
        ## Example
        ```Python
        import numpy as np
        import pymc3 as pm
        import cyclicmodel as cym
        
        # Generate synthetic data,
        # which assumes causal relation from x1 to x2
        n = 200
        x1 = np.random.randn(n)
        x2 = x1 + np.random.uniform(low=-0.5, high=0.5, size=n)
        xs = np.vstack([x1, x2]).T
        
        # Model settings
        hyper_params = cym.define_model.CyclicModelParams(
            dist_std_noise='log_normal',
            df_indvdl=8.0,
            dist_l_cov_21='uniform, -0.9, 0.9',
            dist_scale_indvdl='uniform, 0.1, 1.0',
            dist_beta_noise='uniform, 0.5, 6.0')
        
        # Generate PyMC3 model
        model = cym.define_model.get_pm3_model(xs, hyper_params, verbose=10)
        
        # Run variational inference with PyMC3
        with model:
          fit = pm.FullRankADVI().fit(n=100000)
          trace = fit.sample(1000, include_transformed=True)
        
        # Check the posterior mean of the coefficients
        print(np.mean(trace['b_21']))  # from x1 to x2
        print(np.mean(trace['b_12']))  # from x2 to x1
        ```
        
        ## Installation
        ```bash
        pip install
        ```
        
        ## References
        -  [LiNGAM - Discovery of non-gaussian linear causal models](https://sites.google.com/site/sshimizu06/lingam)
        - [Shimizu, S., & Bollen, K. (2014). Bayesian estimation of causal direction in acyclic structural equation models with individual-specific confounder variables and non-Gaussian distributions. Journal of Machine Learning Research, 15(1), 2629-2652.](http://jmlr.org/papers/volume15/shimizu14a/shimizu14a.pdf)
        
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.5
Classifier: Topic :: Scientific/Engineering :: Mathematics
Description-Content-Type: text/markdown
