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_certificate to setgraphviz()
  • New functionalities to better deal with CPTs. See docs here.

    1. CPTs are automatically generated when using make_DAG
    2. get_parents to get the parents from list with edges.
    3. generate_cpt to generate CPTs per node.
    4. build_cpts_from_structure, to generate CPT for the entire DAG.
  • 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.4

  • Fix for import in discritize.
  • Create a plot after making inferences.
  • Summarize inference results

``` query = bn.inference.fit(model, variables, evidence, plot=True) print(query.text)

```

- Jupyter Notebook
Published by erdogant 10 months ago

bnlearn - 0.10.3

  • Freeze pgmpy at version 0.1.26 because the latest version 1.0.0 is a major update that contains many changes.
  • Replace setup.py with pyproject.toml
  • Cleaning and refactoring

- Jupyter Notebook
Published by erdogant 10 months ago

bnlearn - 0.10.2

Fix for bug #105

- Jupyter Notebook
Published by erdogant over 1 year ago

bnlearn - v0.10.1

Fix for bug "DBN" not in config found.

- Jupyter Notebook
Published by erdogant over 1 year 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.1

  • bug fix when using parameter learning

- 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.9

  • Fix for issue #98 Where the interactive plot sometimes produced an error. The issue was that nodenames are cleaned in d3blocks but this step was skipped in the interactive plot of bnlearn.

- Jupyter Notebook
Published by erdogant over 1 year ago

bnlearn - 0.8.8

  • Latest version of pandas is supported again.

- Jupyter Notebook
Published by erdogant almost 2 years ago

bnlearn - 0.8.7

  • Fix for showing the weights in the edges for the static plot

- Jupyter Notebook
Published by erdogant almost 2 years ago

bnlearn - 0.8.6

  • Fix for issue #99
  • Removed d3blocks from setup /requirements and added it as check when using the interactive plot functionality

- Jupyter Notebook
Published by erdogant almost 2 years ago

bnlearn - 0.8.5

  • add d3blocks to setup and requirements with minimum version. The wrong version can break the interactive plots.

- Jupyter Notebook
Published by erdogant almost 2 years ago

bnlearn - v0.8.4

  • Fix the issue, sorting the continuous_columns in the correct order when discretizing continuous data @ankh1999

- Jupyter Notebook
Published by erdogant over 2 years ago

bnlearn - v0.8.3

  • Fix for the dynamic plot. #89 The labels are now correctly shown again.
  • Fix for when calling the .predict method. #87 Many thanks to @ankh1999

- Jupyter Notebook
Published by erdogant over 2 years ago

bnlearn - v0.8.2

  • fix for recursive model check

- Jupyter Notebook
Published by erdogant over 2 years ago

bnlearn - v0.8.1

  • Removed lowering of pathname in the import_DAG function.
  • Added new scoring method: BDSand AIC
  • 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 bnlearn and are now imported from datazets library.
  • 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.16

  • fix for disabling verbose message

- Jupyter Notebook
Published by erdogant almost 3 years ago

bnlearn - v0.7.15

  • Freeze pandas package to 1.5.3 because of error in iteritems that is used in underlying pgmpy package.
  • A huge new implementation with new functionalities but this needs to be documented first.

- Jupyter Notebook
Published by erdogant almost 3 years ago

bnlearn - v0.7.14

  • added library requests

- Jupyter Notebook
Published by erdogant almost 3 years ago

bnlearn - v0.7.13

  • Fix for import examples (requires latest numpy version)
  • replaced wget with internal python function.

- Jupyter Notebook
Published by erdogant almost 3 years ago

bnlearn - v0.7.12

  • Added cdn resources to fix interactive plot in jupyter notebook and Colab

- Jupyter Notebook
Published by erdogant about 3 years ago

bnlearn - v0.7.11

  • Fix for interactive plot. It did not show up correctly but now it does again.

- Jupyter Notebook
Published by erdogant about 3 years ago

bnlearn - v0.7.10

  • sklearnis changed to scikit-learn in the setup and requirements (issue #66 )

- Jupyter Notebook
Published by erdogant about 3 years ago

bnlearn - v0.7.9

  • plot function bn.plot(model) return figure axis.
  • Setup file contains import of python-louvain instead of community
  • 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.7

  • check_model now uses Decimals to prevent Floating Point Errors in the checks: Issue #60.

- Jupyter Notebook
Published by erdogant over 3 years ago

bnlearn - v0.7.6

  • CPDs are now returned from print_CPD for further usage.

- Jupyter Notebook
Published by erdogant over 3 years ago

bnlearn - v0.7.5

  • Fix for issues #37 where query2df is fixed to output a structured dataframe with the query information.
  • Added unit test for this issue.

- 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.3

  • added input parameter n_jobs where possible

- Jupyter Notebook
Published by erdogant almost 4 years ago

bnlearn - v0.7.2

  • improved speed in predict functionality
  • Add scoretypeto parameter_learning

- Jupyter Notebook
Published by erdogant almost 4 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 of networkx should 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 - v0.6.3

  • added pyvisto setup file and requirements.

- Jupyter Notebook
Published by erdogant almost 4 years ago

bnlearn - v0.6.2

  • fix for bn.print_CPD()
  • name convention: bayesianmodel into bayesiannetwork

- Jupyter Notebook
Published by erdogant almost 4 years ago

bnlearn - 0.6.1

  • Name convention: BayesianModel is changed into BayesianNetwork

- Jupyter Notebook
Published by erdogant about 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.1

  • Improvements in independence test. It should also work now after parameter_learning.
  • Improvements in plots
  • Code refactoring

- Jupyter Notebook
Published by erdogant about 4 years ago

bnlearn - 0.5.0

  • implementation of bnlearn.independence_test functionality 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.11

  • small fixes

- 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.9

  • edge properties can be changed for plotting purposes
    • color (per edge)
    • weight (per edge)
    • edge_alpha (overall)
    • arrowstyle (overall)
    • arrowsize (overall)

- Jupyter Notebook
Published by erdogant about 4 years ago

bnlearn - 0.4.8

  • added doi

- Jupyter Notebook
Published by erdogant about 4 years ago

bnlearn - 0.4.7

  • added missing package: tabulate

- Jupyter Notebook
Published by erdogant about 4 years ago

bnlearn - 0.4.6

  • output of inference variables is ordered in the same manner as defined in the input.

- Jupyter Notebook
Published by erdogant over 4 years ago

bnlearn - 0.4.5

  • Bug fix that fixes handling multiple categorical values in the inference.

- Jupyter Notebook
Published by erdogant over 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.3

  • Added licence to setup

- Jupyter Notebook
Published by erdogant over 4 years ago

bnlearn - 0.4.2

  • Added functionality to save and load models!
  • Examples: https://erdogant.github.io/bnlearn/pages/html/saving%20and%20loading.html

update to the latest version with: pip install -U bnlearn

- 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.19

  • New functionality added: topological sorting of the DAG.
  • Example of usage: https://erdogant.github.io/bnlearn/pages/html/topological_sort.html

- Jupyter Notebook
Published by erdogant over 4 years ago

bnlearn - 0.3.18

  • Fix for the maximum likelihood estimation in parameter learning using the model.fit approach (thanks to ssomanch)

- Jupyter Notebook
Published by erdogant over 4 years ago

bnlearn - 0.3.17

  • Fix typo in pip install instructions Thanks to the contribution of bencevans!

- Jupyter Notebook
Published by erdogant almost 5 years ago

bnlearn - 0.3.16

  • tabu_length is configurable in hill climb search (Thanks to contribution of ivylee!)

- Jupyter Notebook
Published by erdogant almost 5 years ago

bnlearn - 0.3.15

  • the use of blacklist and whitelist requires setting parameter method type
  • update unit test
  • update sphinx docs

- Jupyter Notebook
Published by erdogant about 5 years ago

bnlearn - 0.3.14

  • Better variable naming in "sampling" function.
  • Fix for minimum requirement matplotlib

- Jupyter Notebook
Published by erdogant about 5 years ago

bnlearn - 0.3.13

  • Some fixes to install latest packages

- Jupyter Notebook
Published by erdogant about 5 years ago

bnlearn - 0.3.12

  • Fixes to stay compatible with latest version of pgmpy (0.1.13)
  • Added functionality to perform structure learning using method of Chow-Liu
  • Random code cleaning, pep styling

- Jupyter Notebook
Published by erdogant about 5 years ago

bnlearn - 0.3.11

  • Fixed output to console using the verbosity. If it is set to 0, nothing should be printed.

- Jupyter Notebook
Published by erdogant over 5 years ago

bnlearn - 0.3.10

  • check for CPDs validity.

- Jupyter Notebook
Published by erdogant over 5 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 - 0.3.7

  • added to hc: whitelist, blacklist enforcing or filtering possibility
  • added to hc: epsilon parameter
  • added to hc: max_iter parameter

- Jupyter Notebook
Published by erdogant over 5 years ago

bnlearn - 0.3.6

  • Fix for white/black listing.

- Jupyter Notebook
Published by erdogant over 5 years ago

bnlearn - 0.3.5

Fix for example in spynx

- Jupyter Notebook
Published by erdogant over 5 years ago

bnlearn - 0.3.4

  • code refactoring
  • bug fix for inference on dag

- 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 - 0.3.1

  • Added new example titanic
  • Sprinkler and titanic dataset is downloaded if required
  • Added functionality to convert raw dataframe to one-hot datamatrix
  • docstring updates
  • sphinx updates

- Jupyter Notebook
Published by erdogant almost 6 years ago

bnlearn - 0.3.0

  • Unit tests added!
  • bnlearn.printDAG changed into bnlearn.printCPD
  • output of bnlearn.parameter_learning is a dict containing the model and adjmat.

- Jupyter Notebook
Published by erdogant almost 6 years ago

bnlearn - 0.2.3

Documentation link changed: https://erdogant.github.io/bnlearn

- Jupyter Notebook
Published by erdogant almost 6 years ago

bnlearn - 0.2.2

Added new functionality to bnlearn: * makeDAG() * printDAG() * adjmat2vec() * vec2adjmat()

  • Documentation: https://erdogant.github.io/bnlearn/

- Jupyter Notebook
Published by erdogant almost 6 years ago

bnlearn - 0.2.1

  • Docstring improvements
  • Code cleaning
  • Compatible with latest version of pgmpy (v0.1.10)
  • blacklist and whitelist incorporated for structure learning
  • Bugfix for BDueScore

- Jupyter Notebook
Published by erdogant about 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

bnlearn - Missing functions added

- Jupyter Notebook
Published by erdogant about 6 years ago

bnlearn - calling function in init fix

- Jupyter Notebook
Published by erdogant about 6 years ago

bnlearn - Very first one!

- Jupyter Notebook
Published by erdogant about 6 years ago