Recent Releases of bnlearn
bnlearn - 0.11.1
- Bugfix in parameter learning: structure scores were in some edge cases not computed
- pgmpy version is frozen at 0.1.25 because this is the last version that does not contain various LLM and google-ai packages.
- Fix for warning for plots in inferences
- Jupyter Notebook
Published by erdogant 10 months ago
bnlearn - 0.11.0
New release with many new updates!
- Added parameter
verify_certificatetosetgraphviz() New functionalities to better deal with CPTs. See docs here.
- CPTs are automatically generated when using
make_DAG get_parentsto get the parents from list with edges.generate_cptto generate CPTs per node.build_cpts_from_structure, to generate CPT for the entire DAG.
- CPTs are automatically generated when using
Update numpy docstrings and error messages are updated
Update Requirements and pyproject.toml
Update unit tests
Cleaning code/ refactoring
Have fun!
- Jupyter Notebook
Published by erdogant 10 months ago
bnlearn - 0.10.0
The impute functionality has been extended with the MICE method thanks to @Ananyapam7 (issue #81). In addition, I also added functionality to impute missing categorical values.
Key features include: * Supports K-NN imputation for numeric columns. * Supports MICE imputation for numeric columns. * Numeric columns are auto-identified and converted for imputation where necessary. * Includes options to specify the imputation estimator, number of iterations (max_iter), and verbosity level for logging. * String/categorical columns are imputed.
Created a new file impute.py for imputation related functions. See examples and more information in the documentation pages.
- Jupyter Notebook
Published by erdogant over 1 year ago
bnlearn - 0.9.0
- Lingam methods (Direct and ICA) are implemented to model datasets with continuous variables (without discretizing). See docs here. #36 #94
- Plotting is now possible using Graphviz which creates more clear figures. See docs here.
- For Constraint-based (PC), CII 9 tests are included and the alpha can be set.
- Parameter showfig and visible is available now for plotting #103
- Dynamic Bayesian Network (DBN) implemented. #100. See docs here and here.
- Impute functionality implemented in case of missing values. #81 See docs over here.
- Updated docstrings and sphinx documentation pages.
- Created a logo! :-)
- Jupyter Notebook
Published by erdogant over 1 year ago
bnlearn - v0.8.1
- Removed lowering of pathname in the
import_DAGfunction. - Added new scoring method:
BDSandAIC - Created groupby functionality for inferences that allows grouping similar categories.
Auto-convert non-numerical columns into numerical when discretizing
Code refactoring
Small improvements docstrings
- Jupyter Notebook
Published by erdogant over 2 years ago
bnlearn - v0.8.0
I am really happy to announce the following new great functionalities in bnlearn!
- Continuous data modeling is possible using the approach of Yi-Chun Chen et al.
- Interactive plots are created using
D3Blockswhich provides more flexibility. - Data examples and functions are removed from
bnlearnand are now imported fromdatazetslibrary. - Unit tests updated and new ones implemented
Especially for the plot functionality, some of the input parameters are changed.
See the docs for continuous data modeling
- Jupyter Notebook
Published by erdogant almost 3 years ago
bnlearn - v0.7.9
- plot function
bn.plot(model)return figure axis. - Setup file contains import of
python-louvaininstead ofcommunity - docstring updates regarding this output.
Example: ``` model = bn.import_DAG('sprinkler', CPD=True) df = bn.sampling(model, n=1000, methodtype='bayes') fig = bn.plot(model) fig['ax']
```
- Jupyter Notebook
Published by erdogant about 3 years ago
bnlearn - v0.7.8
- Added functionality to compute sctructure scores when using parameter of structure learning. This can help to decide which scoring type may give a better fit ('bic', 'k2', 'bdeu'). The results scores are directly stored in the output.
``` import bnlearn as bn
Load example dataset
df = bn.import_example('sprinkler')
edges = [('Cloudy', 'Sprinkler'), ('Cloudy', 'Rain'), ('Sprinkler', 'WetGrass'), ('Rain', 'WetGrass')]
Make the actual Bayesian DAG
DAG = bn.makeDAG(edges) model = bn.parameterlearning.fit(DAG, df)
model['structure_scores'] {'k2': -33962.61414408797, 'bds': -57992.919156623604, 'bic': -94337.69274492635, 'bdeu': -33670.95375881856}
```
- Jupyter Notebook
Published by erdogant over 3 years ago
bnlearn - v0.7.4
- Added Gibbs sampling. See the docs for examples.
- Improvements in verbosity messages.
- Some code refactoring/cleaning.
- Jupyter Notebook
Published by erdogant over 3 years ago
bnlearn - v0.7.1
- smooth parameter added to
parameter_learning
``` import bnlearn as bn DAG = bn.import_DAG('water', verbose=0)
Sampling
df = bn.sampling(DAG, n=1000)
Parameter learning
model = bn.parameter_learning.fit(DAG, df, smooth=None)
```
- Jupyter Notebook
Published by erdogant almost 4 years ago
bnlearn - v0.7.0
- Fix for plotting due to new version of
networkx. The version ofnetworkxshould be >= 2.7.1 - Layout can now be changed more easily
- figsize added as an input parameter which is more convenient than width/height.
``` import bnlearn as bn df = bn.importexample('asia') model = bn.structurelearning.fit(df)
Plot
bn.plot(model)
Plot with different layouts
bn.plot(model, paramsstatic={'layout':'spectrallayout'}) bn.plot(model, paramsstatic={'layout':'planarlayout'}) bn.plot(model, paramsstatic={'layout':'kamadakawailayout'}) bn.plot(model, paramsstatic={'layout':'springlayout'}) bn.plot(model, paramsstatic={'layout':'circular_layout', "figsize": (15, 10)})
```
- Jupyter Notebook
Published by erdogant almost 4 years ago
bnlearn - 0.6.0
- New conversion functionalities to convert source-target vector into sparse dataframe:
vec2df - Sphinx pages updated: https://erdogant.github.io/bnlearn/pages/html/dataframe%20conversions.html
- Docstrings updated and included.
``` import bnlearn as bn
Load large example with source-target edges
vec = bn.import_example("stormofswords")
Convert to dataframe
df = bn.vec2df(vec['source'], vec['target'], weights=vec['weight']) ```
- Jupyter Notebook
Published by erdogant about 4 years ago
bnlearn - 0.5.2
- Added new functionality vec2df to create dataframe from source-target-weights
- Added new example to demonstrate the usage
- updated some docstrings
Example vec2df:
``` import bnlearn as bn
source=['Cloudy','Cloudy','Sprinkler','Rain'] target=['Sprinkler','Rain','WetGrass','WetGrass'] weights=[1,2,1,3]
Convert into sparse datamatrix
df = bn.vec2df(source, target, weights=weights)
Cloudy Rain Sprinkler Wet_Grass
0 True False True False
1 True True False False
2 True True False False
3 False False True True
4 False True False True
5 False True False True
6 False True False True
```
- Jupyter Notebook
Published by erdogant about 4 years ago
bnlearn - 0.5.0
- implementation of
bnlearn.independence_testfunctionality that allows to compute edge strength - plots improved for the edge weights
- more pep styling
- some code refactoring
```
Example:
Load asia DAG
df = bn.import_example(data='alarm')
Structure learning of sampled dataset
model = bn.structure_learning.fit(df)
Compute edge strength with the chi_square test statistic. Set prune=True to remove the none-significant edges.
model = bn.independencetest(model, df, test='chisquare', prune=False)
Make plot
bn.plot(model)
```
- Jupyter Notebook
Published by erdogant about 4 years ago
bnlearn - 0.4.10
- Bugfix when plotting when using edge_properties.
- added naivebayes method for creating DAG.
- added naivebayes method for structure learning.
- code refactoring.
- Updating docstrings.
- Updated unit tests
Let me know if there are accidental new bugs introduced!
- Jupyter Notebook
Published by erdogant about 4 years ago
bnlearn - 0.4.4
- New functionalities in creating plots for both interactive and static plots.
- Change node colors
- Change node sizes
- Adjust plot settings such as fonts, font-colors, background color etc.
- https://erdogant.github.io/bnlearn/pages/html/Plot.html
- Jupyter Notebook
Published by erdogant over 4 years ago
bnlearn - 0.4.1
- added interactive plot with pyvis using the plot functionality with parameter
bn.plot(model, interactive=True)
``` import bnlearn as bn df = bn.import_example()
Structure learning
model = bn.structure_learning.fit(df) bn.plot(model, interactive=True)
```
- Jupyter Notebook
Published by erdogant over 4 years ago
bnlearn - 0.4.0
- Included fixed_edges when using
methodtype='hc' - Changed the bwlistmethod for clarity.
- bwlistmethod='enforce' into bwlistmethod='edges'
- bwlistmethod='filter' into bwlistmethod='nodes'
- Some docstring updates
- Some code cleaning
Note that bw_list_method='nodes' works for all methodtypes and bw_list_method='edges' only when methodtype='hc'
- Jupyter Notebook
Published by erdogant over 4 years ago
bnlearn - 0.3.22
- Added new tree search based structure learning method: Tree-augmented Naive Bayes (TAN)
Example
``` import bnlearn as bn df = bn.import_example()
Structure learning with TAN
model = bn.structurelearning.fit(df, methodtype='tan', rootnode='Cloudy', class_node='Rain') bn.plot(model)
```
- Jupyter Notebook
Published by erdogant over 4 years ago
bnlearn - 0.3.21
- Fix for scoring_method that occured in newer versions from pgmpy/python
- Fix for returntype in forwardsampling
- removed examples from library and included functionality to auto-download
- Update of requirements
- Update unit test
- Some code refactoring
- Jupyter Notebook
Published by erdogant over 4 years ago
bnlearn - 0.3.20
- Functionally added to make predictions on dataset with the predict function #17
- Predict examples can be found in the readme and sphinx pages: https://erdogant.github.io/bnlearn/pages/html/Predict.html
- Functionally added that outputs a dataframe with the results for the inference that is made (query2df)
- Included some exceptions to catch errors
- Fixed circular imports
- Unit test updated for the new functions
- Some docstrings updated
- Some code refactoring and cleaning
- Jupyter Notebook
Published by erdogant over 4 years ago
bnlearn - 0.3.8
- fix for plot as it did not work anymore because of update in networkx.
- fix for printing CPDs. This was not always possible.
- verbosity messages capitalized chars are lowered
- Check for networkx version, should be >2.5
- docstring updates
- improvements in code styling
- Jupyter Notebook
Published by erdogant over 5 years ago
bnlearn -
- df2onehot outputs numerical and one-hot
- Jupyter Notebook
Published by erdogant almost 6 years ago
bnlearn - 0.3.2
- update in docstrings
- inferences can now be done with the output of parameter_learning
- added fuction to convert adjmat to BayesianModel (to_BayesianModel)
- Added example of inference
- updates sphnix pages: https://erdogant.github.io/bnlearn/pages/html/Examples.html#start-with-raw-data
- Jupyter Notebook
Published by erdogant almost 6 years ago
bnlearn -
- structurelearning() -> structurelearning.fit()
- parameterlearning() -> parameterlearning.fit()
- inference() -> inference.fit()
- Simplified input for plot().
- Code refactoring
- Code cleaning
- Doc strings added
- Jupyter Notebook
Published by erdogant about 6 years ago
bnlearn -
- Function name for loading example changed to import_DAG
- reading example dataframe with sprinkler data added by bnlearn.import_example()
- Verbosity fix
- Jupyter Notebook
Published by erdogant about 6 years ago