py-banshee


Namepy-banshee JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/mike-mendoza/py_banshee
SummaryPy_Banshee allows for quantifying non-parametric Bayesian Networks
upload_time2023-11-14 12:12:34
maintainer
docs_urlNone
authorPaul Koot, Miguel Angel Mendoza Lugo, Oswaldo Morales Napoles
requires_python
licenseGNU
keywords pypi py_banshee tutorial
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BANSHEE

Bayesian Networks (BNs) are probabilistic, graphical models for representing complex dependency structures. They have many applications in science and engineering. Their particularly powerful variant – Non-Parametric BNs – are  implemented as a Matlab toolbox and an open-access scriptable code, in the form of a Python-based package.

This repository contains:
* PyBanshee a Python-based open source of the MATLAB toolbox.
  
The supporting SoftwareX paper for PyBanhsee, _PyBanshee version (1.0): A Python implementation of the MATLAB toolbox BANSHEE for Non-Parametric Bayesian Networks with updated features_, can be found at https://doi.org/10.1016/j.softx.2022.101279 

These codes are an update of the original version supporting SoftwareX paper: https://doi.org/10.1016/j.softx.2020.100588. The latest version of MATLAB BANSHEE (v1.3) supprting SoftwareX papper can be found at https://doi.org/10.1016/j.softx.2023.101479

The packages allows for quantifying the BN, validating the underlying assumptions of the model, visualizing the network and its corresponding rank correlation matrix, sampling and finally making inference with a BN based on existing or new evidence. MATLAB BANSHEE v1.3 and Py_BANSHEE have the same features.

# PyBanshee

PyBanshee  is a Python-based open source of the MATLAB toolbox [BANSHEE](https://doi.org/10.1016/j.softx.2020.100588). 

## Installation and updating
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install last stable version of the package. 

```bash
pip install py-banshee
```
However, if you are looking for the latest updates, consider installation directly from sources.
```
git clone https://github.com/mike-mendoza/py_banshee.git
cd py_banshee
python setup.py install
```

## Usage
Features:
* py_banshee.rankcorr.bn_rankcorr  --> Create a Bayesian Network rank correlation matrix 
* py_banshee.bn_plot.bn_visualize    --> Visualize the structure of a defined Bayesian Network
* py_banshee.copula_test.cvm_statistic      --> Goodness-of-fit test for copulas
* py_banshee.d_cal.gaussian_distance  --> Measure the distance between Gaussian densities
* py_banshee.sample_bn.generate_samples  --> Make samples using the defined Bayesian Network
* py_banshee.sample_bn.sample_base_conditioning --> Make samples based conditioning on intervals
* py_banshee.prediction.inference  --> Make predictions using a non-parametric Bayesian Network
* py_banshee.prediction.conditional_margins_hist  --> Visualize the un-conditional and conditional marginal histograms

#### Demo of some of the features:

```python
from py_banshee.rankcorr import bn_rankcorr
from py_banshee.bn_plot import bn_visualize
from py_banshee.prediction import inference,conditional_margins_hist

#Defining the variables of the BN
names = ['V1','V2','V3']  #names of the variables (nodes)
N = len(names) 		      #number of nodes

#parametric distributions of the nodes
distributions = ['norm','genextreme','norm']	
parameters = [[100,23],[-0.15,130,50],[500,100]]

#Defining the structure of the BN
ParentCell = [None]*N
ParentCell[0] = []
ParentCell[1] = [0]
ParentCell[2] = [0,1]

#Defining the rank correlation matrix
RankCorr = [None]*N
RankCorr[0] = []
RankCorr[1] = [.1]
RankCorr[2] = [.41,-.25]

#Conditional rank correlation matrix
R = bn_rankcorr(ParentCell,RankCorr,var_names=names,is_data=False, plot=True)

#Plot of the Bayesian Network
bn_visualize(ParentCell,R,names,fig_name='BN_TEST')

# Inference
condition_nodes = [0] #conditionalized variables (node V1)
condition_values = [181] #conditionalized value (node V1)

F = inference(Nodes = condition_nodes,
              Values = condition_values,
              R=R,
              DATA=[],
              SampleSize=100000,
              empirical_data=False, 
              distributions=distributions,
              parameters=parameters,
              Output='full')

#Conditional and un-conditional histograms 
conditional_margins_hist(F,[],names,condition_nodes,
                         empirical_data = False,
                         distributions=distributions,
                         parameters=parameters)
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License
[GNU](https://choosealicense.com/licenses/gpl-3.0/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mike-mendoza/py_banshee",
    "name": "py-banshee",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pypi,py_banshee,tutorial",
    "author": "Paul Koot, Miguel Angel Mendoza Lugo, Oswaldo Morales Napoles",
    "author_email": "mendozalugo@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6f/27/fc7d6850f23c311cd1c88c0dac3ce9ae2ad8144b35df49afb7dc42e22fa8/py_banshee-1.1.1.tar.gz",
    "platform": null,
    "description": "# BANSHEE\r\n\r\nBayesian Networks (BNs) are probabilistic, graphical models for representing complex dependency structures. They have many applications in science and engineering. Their particularly powerful variant \u2013 Non-Parametric BNs \u2013 are  implemented as a Matlab toolbox and an open-access scriptable code, in the form of a Python-based package.\r\n\r\nThis repository contains:\r\n* PyBanshee a Python-based open source of the MATLAB toolbox.\r\n  \r\nThe supporting SoftwareX paper for PyBanhsee, _PyBanshee version (1.0): A Python implementation of the MATLAB toolbox BANSHEE for Non-Parametric Bayesian Networks with updated features_, can be found at https://doi.org/10.1016/j.softx.2022.101279 \r\n\r\nThese codes are an update of the original version supporting SoftwareX paper: https://doi.org/10.1016/j.softx.2020.100588. The latest version of MATLAB BANSHEE (v1.3) supprting SoftwareX papper can be found at https://doi.org/10.1016/j.softx.2023.101479\r\n\r\nThe packages allows for quantifying the BN, validating the underlying assumptions of the model, visualizing the network and its corresponding rank correlation matrix, sampling and finally making inference with a BN based on existing or new evidence. MATLAB BANSHEE v1.3 and Py_BANSHEE have the same features.\r\n\r\n# PyBanshee\r\n\r\nPyBanshee  is a Python-based open source of the MATLAB toolbox [BANSHEE](https://doi.org/10.1016/j.softx.2020.100588). \r\n\r\n## Installation and updating\r\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install last stable version of the package. \r\n\r\n```bash\r\npip install py-banshee\r\n```\r\nHowever, if you are looking for the latest updates, consider installation directly from sources.\r\n```\r\ngit clone https://github.com/mike-mendoza/py_banshee.git\r\ncd py_banshee\r\npython setup.py install\r\n```\r\n\r\n## Usage\r\nFeatures:\r\n* py_banshee.rankcorr.bn_rankcorr  --> Create a Bayesian Network rank correlation matrix \r\n* py_banshee.bn_plot.bn_visualize    --> Visualize the structure of a defined Bayesian Network\r\n* py_banshee.copula_test.cvm_statistic      --> Goodness-of-fit test for copulas\r\n* py_banshee.d_cal.gaussian_distance  --> Measure the distance between Gaussian densities\r\n* py_banshee.sample_bn.generate_samples  --> Make samples using the defined Bayesian Network\r\n* py_banshee.sample_bn.sample_base_conditioning --> Make samples based conditioning on intervals\r\n* py_banshee.prediction.inference  --> Make predictions using a non-parametric Bayesian Network\r\n* py_banshee.prediction.conditional_margins_hist  --> Visualize the un-conditional and conditional marginal histograms\r\n\r\n#### Demo of some of the features:\r\n\r\n```python\r\nfrom py_banshee.rankcorr import bn_rankcorr\r\nfrom py_banshee.bn_plot import bn_visualize\r\nfrom py_banshee.prediction import inference,conditional_margins_hist\r\n\r\n#Defining the variables of the BN\r\nnames = ['V1','V2','V3']  #names of the variables (nodes)\r\nN = len(names) \t\t      #number of nodes\r\n\r\n#parametric distributions of the nodes\r\ndistributions = ['norm','genextreme','norm']\t\r\nparameters = [[100,23],[-0.15,130,50],[500,100]]\r\n\r\n#Defining the structure of the BN\r\nParentCell = [None]*N\r\nParentCell[0] = []\r\nParentCell[1] = [0]\r\nParentCell[2] = [0,1]\r\n\r\n#Defining the rank correlation matrix\r\nRankCorr = [None]*N\r\nRankCorr[0] = []\r\nRankCorr[1] = [.1]\r\nRankCorr[2] = [.41,-.25]\r\n\r\n#Conditional rank correlation matrix\r\nR = bn_rankcorr(ParentCell,RankCorr,var_names=names,is_data=False, plot=True)\r\n\r\n#Plot of the Bayesian Network\r\nbn_visualize(ParentCell,R,names,fig_name='BN_TEST')\r\n\r\n# Inference\r\ncondition_nodes = [0] #conditionalized variables (node V1)\r\ncondition_values = [181] #conditionalized value (node V1)\r\n\r\nF = inference(Nodes = condition_nodes,\r\n              Values = condition_values,\r\n              R=R,\r\n              DATA=[],\r\n              SampleSize=100000,\r\n              empirical_data=False, \r\n              distributions=distributions,\r\n              parameters=parameters,\r\n              Output='full')\r\n\r\n#Conditional and un-conditional histograms \r\nconditional_margins_hist(F,[],names,condition_nodes,\r\n                         empirical_data = False,\r\n                         distributions=distributions,\r\n                         parameters=parameters)\r\n```\r\n## Contributing\r\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\r\n\r\n## License\r\n[GNU](https://choosealicense.com/licenses/gpl-3.0/)\r\n",
    "bugtrack_url": null,
    "license": "GNU",
    "summary": "Py_Banshee allows for quantifying non-parametric Bayesian Networks",
    "version": "1.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/mike-mendoza/py_banshee/issues",
        "Download": "https://github.com/mike-mendoza/py_banshee/archive/refs/tags/v1.1.1.tar.gz",
        "Homepage": "https://github.com/mike-mendoza/py_banshee"
    },
    "split_keywords": [
        "pypi",
        "py_banshee",
        "tutorial"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6f27fc7d6850f23c311cd1c88c0dac3ce9ae2ad8144b35df49afb7dc42e22fa8",
                "md5": "4471d7ea53160251ae28a78de7c1cee3",
                "sha256": "c11e9812612480fff73e0c91cdfda554151a8bdac6ae63c446e2e29c17d1f616"
            },
            "downloads": -1,
            "filename": "py_banshee-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4471d7ea53160251ae28a78de7c1cee3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 34346,
            "upload_time": "2023-11-14T12:12:34",
            "upload_time_iso_8601": "2023-11-14T12:12:34.327032Z",
            "url": "https://files.pythonhosted.org/packages/6f/27/fc7d6850f23c311cd1c88c0dac3ce9ae2ad8144b35df49afb7dc42e22fa8/py_banshee-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-14 12:12:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mike-mendoza",
    "github_project": "py_banshee",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "py-banshee"
}
        
Elapsed time: 0.13731s