BayesInference


NameBayesInference JSON
Version 0.0.15 PyPI version JSON
download
home_pageNone
SummaryGNU GENERAL PUBLIC LICENSE
upload_time2025-08-20 08:46:46
maintainerNone
docs_urlNone
authorSebastian Sosa
requires_python>=3.9
licenseNone
keywords python bayesian inferences
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Bayesian Inference (BI) 
 BI software is available in both Python and R. It aims to unify the modeling experience by integrating an intuitive model-building syntax with the flexibility of low-level abstraction coding available but also pre-build function for high-level of abstraction and including hardware-accelerated computation for improved scalability.

Currently, the package provides:

+ Data manipulation:
    + One-hot encoding
    + Conversion of index variables
    + Scaling
      
+ Models (Using Numpyro):
  
    + Linear Regression for continuous variable
    + Multiple continuous Variable
    + Interaction between variables
    + Categorical variable
    + Binomial model
    + Beta binomial
    + Poisson model
    + Gamma-Poisson
    + Multinomial
    + Dirichlet model
    + Zero inflated
    + Varying intercept
    + Varying slopes
    + Gaussian processes
    + Measuring error
    + Latent variable]
    + PCA
    + GMM
    + DPMM
    + Network model
    + Network with block model
    + Network control for data collection biases 
    + BNN
  
+ Model diagnostics (using ARVIZ):
    + Data frame with summary statistics
    + Plot posterior densities
    + Bar plot of the autocorrelation function (ACF) for a sequence of data
    + Plot rank order statistics of chains
    + Forest plot to compare HDI intervals from a number of distributions
    + Compute the widely applicable information criterion
    + Compare models based on their expected log pointwise predictive density (ELPD)
    + Compute estimate of rank normalized split-R-hat for a set of traces
    + Calculate estimate of the effective sample size (ESS)
    + Pair plot
    + Density plot
    + ESS evolution plot
      


# Why?
## 1.  To learn

## 2.  Easy Model Building:
The following linear regression model (rethinking 4.Geocentric Models): 
$$
\text{height} \sim \mathrm{Normal}(\mu,\sigma)
$$

$$
\mu = \alpha + \beta \cdot \text{weight}
$$

$$
\alpha \sim \mathrm{Normal}(178,20)
$$

$$
\beta \sim \mathrm{Normal}(0,10)
$$

$$
\sigma \sim \mathrm{Uniform}(0,50)
$$
    
can be declared in the package as
```
from BI import bi

# Setup device------------------------------------------------
m = bi(platform='cpu')

# Import Data & Data Manipulation ------------------------------------------------
# Import
from importlib.resources import files
data_path = files('BI.resources.data') / 'Howell1.csv'
m.data(data_path, sep=';') 
m.df = m.df[m.df.age > 18] # Manipulate
m.scale(['weight']) # Scale

# Define model ------------------------------------------------
def model(weight, height):    
    a = m.dist.normal(178, 20, name = 'a') 
    b = m.dist.lognormal(0, 1, name = 'b') 
    s = m.dist.uniform(0, 50, name = 's') 
    m.normal(a + b * weight , s, obs = height) 

# Run mcmc ------------------------------------------------
m.fit(model)  # Optimize model parameters through MCMC sampling

# Summary ------------------------------------------------
m.summary() # Get posterior distributions
```            

# Todo 
1. GUI 
2. Documentation
3. Implementation of additional MCMC sampling methods



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "BayesInference",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "python, Bayesian inferences",
    "author": "Sebastian Sosa",
    "author_email": "bi@s-sosa.com",
    "download_url": "https://files.pythonhosted.org/packages/2b/67/6205b159b1223c5e6f11c64a2bb14fd35e0e485e31e1103f6318beddcf37/bayesinference-0.0.15.tar.gz",
    "platform": null,
    "description": "# Bayesian Inference (BI) \n BI software is available in both Python and R. It aims to unify the modeling experience by integrating an intuitive model-building syntax with the flexibility of low-level abstraction coding available but also pre-build function for high-level of abstraction and including hardware-accelerated computation for improved scalability.\n\nCurrently, the package provides:\n\n+ Data manipulation:\n    + One-hot encoding\n    + Conversion of index variables\n    + Scaling\n      \n+ Models (Using Numpyro):\n  \n    + Linear Regression for continuous variable\n    + Multiple continuous Variable\n    + Interaction between variables\n    + Categorical variable\n    + Binomial model\n    + Beta binomial\n    + Poisson model\n    + Gamma-Poisson\n    + Multinomial\n    + Dirichlet model\n    + Zero inflated\n    + Varying intercept\n    + Varying slopes\n    + Gaussian processes\n    + Measuring error\n    + Latent variable]\n    + PCA\n    + GMM\n    + DPMM\n    + Network model\n    + Network with block model\n    + Network control for data collection biases \n    + BNN\n  \n+ Model diagnostics (using ARVIZ):\n    + Data frame with summary statistics\n    + Plot posterior densities\n    + Bar plot of the autocorrelation function (ACF) for a sequence of data\n    + Plot rank order statistics of chains\n    + Forest plot to compare HDI intervals from a number of distributions\n    + Compute the widely applicable information criterion\n    + Compare models based on their expected log pointwise predictive density (ELPD)\n    + Compute estimate of rank normalized split-R-hat for a set of traces\n    + Calculate estimate of the effective sample size (ESS)\n    + Pair plot\n    + Density plot\n    + ESS evolution plot\n      \n\n\n# Why?\n## 1.  To learn\n\n## 2.  Easy Model Building:\nThe following linear regression model (rethinking 4.Geocentric Models): \n$$\n\\text{height} \\sim \\mathrm{Normal}(\\mu,\\sigma)\n$$\n\n$$\n\\mu = \\alpha + \\beta \\cdot \\text{weight}\n$$\n\n$$\n\\alpha \\sim \\mathrm{Normal}(178,20)\n$$\n\n$$\n\\beta \\sim \\mathrm{Normal}(0,10)\n$$\n\n$$\n\\sigma \\sim \\mathrm{Uniform}(0,50)\n$$\n    \ncan be declared in the package as\n```\nfrom BI import bi\n\n# Setup device------------------------------------------------\nm = bi(platform='cpu')\n\n# Import Data & Data Manipulation ------------------------------------------------\n# Import\nfrom importlib.resources import files\ndata_path = files('BI.resources.data') / 'Howell1.csv'\nm.data(data_path, sep=';') \nm.df = m.df[m.df.age > 18] # Manipulate\nm.scale(['weight']) # Scale\n\n# Define model ------------------------------------------------\ndef model(weight, height):    \n    a = m.dist.normal(178, 20, name = 'a') \n    b = m.dist.lognormal(0, 1, name = 'b') \n    s = m.dist.uniform(0, 50, name = 's') \n    m.normal(a + b * weight , s, obs = height) \n\n# Run mcmc ------------------------------------------------\nm.fit(model)  # Optimize model parameters through MCMC sampling\n\n# Summary ------------------------------------------------\nm.summary() # Get posterior distributions\n```            \n\n# Todo \n1. GUI \n2. Documentation\n3. Implementation of additional MCMC sampling methods\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "GNU GENERAL PUBLIC LICENSE",
    "version": "0.0.15",
    "project_urls": {
        "Bug Tracker": "https://github.com/BGN-for-ASNA/BI/issues",
        "Homepage": "https://github.com/BGN-for-ASNA/BI"
    },
    "split_keywords": [
        "python",
        " bayesian inferences"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7509f9598196b52f6f44b01eb76998294f15110ff85ab1513270c86600566871",
                "md5": "88bb179cc0fa36a433f943ec944ea634",
                "sha256": "83717c5075049425b0d67f29aaaf6c09c37e1f60d1e183a38075eaa993f40549"
            },
            "downloads": -1,
            "filename": "bayesinference-0.0.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "88bb179cc0fa36a433f943ec944ea634",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 55669264,
            "upload_time": "2025-08-20T08:46:41",
            "upload_time_iso_8601": "2025-08-20T08:46:41.500015Z",
            "url": "https://files.pythonhosted.org/packages/75/09/f9598196b52f6f44b01eb76998294f15110ff85ab1513270c86600566871/bayesinference-0.0.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2b676205b159b1223c5e6f11c64a2bb14fd35e0e485e31e1103f6318beddcf37",
                "md5": "442c19f19699098fef38c0ccd3e69f01",
                "sha256": "abb8b4a61267c1b09b6e4479895fb3efd0e5e7a9692a00c2a89605061fd5ee6c"
            },
            "downloads": -1,
            "filename": "bayesinference-0.0.15.tar.gz",
            "has_sig": false,
            "md5_digest": "442c19f19699098fef38c0ccd3e69f01",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 55421045,
            "upload_time": "2025-08-20T08:46:46",
            "upload_time_iso_8601": "2025-08-20T08:46:46.392356Z",
            "url": "https://files.pythonhosted.org/packages/2b/67/6205b159b1223c5e6f11c64a2bb14fd35e0e485e31e1103f6318beddcf37/bayesinference-0.0.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-20 08:46:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BGN-for-ASNA",
    "github_project": "BI",
    "github_not_found": true,
    "lcname": "bayesinference"
}
        
Elapsed time: 1.14546s