Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continous data #36

Closed
PARODBE opened this issue Sep 9, 2021 · 23 comments
Closed

Continous data #36

PARODBE opened this issue Sep 9, 2021 · 23 comments
Labels
enhancement New feature or request

Comments

@PARODBE
Copy link

PARODBE commented Sep 9, 2021

Hi again!

I was thinking in using bayesian networks for continous data, do you think that an implementation in order to work with these kind of data could be possible?

Thanks!

@erdogant
Copy link
Owner

At the moment bnlearn can only be used for discrete/categorical analysis. Implementing models that can work with continuous values is on my (long) todo list.

Nevertheless, there are possibilities to model your data if you have continuous data. You may can discretize your variables with domain/experts knowledge. For example, if you have temperature, you can mark temperature < 0 as freezing, and

0 as normal. Or many more smaller categories.

@rafmora
Copy link

rafmora commented Feb 1, 2022

Any update as of today regarding to implementing the continuous values?

@erdogant
Copy link
Owner

erdogant commented Feb 1, 2022

Not yet but I'm planning to give it a start soonish. If you have any suggestions, working examples or methods to start with, let me know.

@rafmora
Copy link

rafmora commented Feb 1, 2022

Yes. Happy to help with examples. I am currently modeling soil corrosivity in Python.
Please let me when you would like to start so I can prepare a easy-to-start example.

@thomasfrederikhoeck
Copy link

Cheers for your work @erdogant . Do you have any kind of ETA on this ? :-)

@erdogant
Copy link
Owner

erdogant commented Jul 5, 2022

Yes Soonish! Hopefully shortly after the summer break in august! #wishfullthinking

@samanemami
Copy link

samanemami commented Jul 21, 2022

Please count on me for adding the feature to the model.
Thanks

@samanemami
Copy link

samanemami commented Aug 6, 2022

@erdogant Have you seen this continuous approach?

@erdogant
Copy link
Owner

erdogant commented Aug 7, 2022

Thank you for spotting this repo! But the repo seems to support also only discrete models.

@samanemami
Copy link

I am thinking of applying their continuous approach to bnlean!

@erdogant
Copy link
Owner

erdogant commented Aug 7, 2022

If you can get it up and running with an example for continuous data, It would be great! But the name of the repo I am seeing is [LearnDiscreteBayesNets.jl], which hints towards discrete models. Can you paste the name of the function(s) of interest to be sure I am looking at the right repo.

@samanemami
Copy link

@erdogant This is its related paper.
And here, the used function, I guess!

@fimselamse
Copy link

@samanemami I think the function you are referring to simply discretizes the data before learning the network.

@samanemami
Copy link

@fimselamse Yes, that is the idea. Couldn't we use it?

@erdogant
Copy link
Owner

erdogant commented Aug 9, 2022

Very interesting though! I am going to read the paper first :-)

@fimselamse
Copy link

@samanemami Yes, this is definitely way to create a network from continous data. However, it is not what's being done in the R bnlearn library. They use a special gaussian case of the scoring function, if I understand it correctly.

@samanemami
Copy link

samanemami commented Aug 10, 2022

Perfect @erdogant, count on me.

@fimselamse, Yes. This is not the method used in R, but this package could add other methods to handle the continuous data as well.

@fimselamse
Copy link

@samanemami Definitely! I have tried some information preserving discretization methods myself. Some results were promising, but not as good as the method used in R. Would love to see the results with this one, though!

@erdogant
Copy link
Owner

erdogant commented Aug 27, 2022

I have been looking into this peace of code and it is written in Julia (I was hoping Python #wishfullthinking). Maybe not a huge issue but manually converting is kind of error-prone and time-consuming. I did find documentation about Julia to Python. I will give that a try first.

If someone here is familiar with Julia, it would be very helpful!

@rafmora
Copy link

rafmora commented Dec 28, 2022

@erdogant regarding real case examples of continuous data (e.g., corrosion), please let me know if I can be of help. Interested to test them using bnlearn. When would you expect to start the new version testing?

@erdogant
Copy link
Owner

erdogant commented Jan 8, 2023

I added the julia code in the github. I did an attempt to manually rewrite it to Python but without being experienced in Julia, it was quite intensive. Now I am thinking to create a small use case to use ChatGPT to let it rewrite it to Python. However, In my experience, the code that chatGPT generates can be buggy and not always correct. Nevertheless, it may be a good starting point to bugfix and rewrite!

@erdogant erdogant added the enhancement New feature or request label Jan 8, 2023
@erdogant
Copy link
Owner

It took a while but in the latest release, there is now an implementation for continuous data modeling!
There are many unit tests to ensure the quality and validity of the results but I did not use it in a real-life scenario yet.

Check it out in the docs.

@erdogant
Copy link
Owner

I am closing this one as there is now a basis functionality that can process continous data!
See the documentations for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants