sambofra / bnstruct

R package for Bayesian Network Structure Learning
GNU General Public License v3.0
17 stars 11 forks source link

Sparsely Sampled Time Series Data Structural Learning Failed #20

Closed Cby19961020 closed 3 years ago

Cby19961020 commented 3 years ago

Hi friend,

First of all thank you very much for your awesome work! I find this package to be very helpful for my research.

I was just playing around with the functions inside this package on my data which is a sparsely sampled time series data(8 variables, 25k entries each) and I've attempted the dynamic structural learning. After running the code for nearly 20 hours I got the following error:

Error in while ((difference > threshold && no.iterations <= max.em.iterations) || : missing value where TRUE/FALSE needed In addition: There were 50 or more warnings (use warnings() to see the first 50)

Note that I also attempted the structural learning using the evenly sampled data(i.e. no missing values) and was able to obtain the causal diagram within minutes.

Please take a look and kindly let me know what the problem is. I am not the expert so it could have been me... Thanks again for all your hard work buddy!

BNStruct_Test.zip

albertofranzin commented 3 years ago

Hello,

and thank you.

There was indeed an issue in the handling of the continuous variables in EM (which does not get run for complete data, that's why that case worked fine). I did not run your example until the end, but I let it go for a while and there were no warnings (which appeared quite early before).

Can you please try with the latest commit? It should work, please let me know if it does not.

Please note that the long runtimes depend also on how many observations are missing, so there is not necessarily something wrong with that.

Cheers

Cby19961020 commented 3 years ago

Hey buddy,

Thank you for your prompt reply. I am having some difficulties updating the package from 1.0.8 to 1.0.9 using github_install command, following error is received:

Error: Failed to install 'bnstruct' from GitHub: (converted from warning) installation of package ‘C:/Users/AppData/Local/Temp/Rtmp0ae7kg/file444c49dd2feb/bnstruct_1.0.9.tar.gz’ had non-zero exit status

I am wondering if I could just install the latest version from CRAN? Please let me know. Thank you!

albertofranzin commented 3 years ago

Are there any error lines before those ones?

I want to run some more tests before submitting the package to CRAN, but the time is scarce... In the meantime, you can try with the package in attachment. Let me know if it works.

Cheers

bnstruct_1.0.9.tar.gz

Cby19961020 commented 3 years ago

Hi friend,

Thanks again for your prompt reply. No there wasn't any error before those lines, but the console did output a statement saying there are more then 50 warnings when finished running.

For some reason I am still unable to install the 1.0.9 package because of the same error. I don't know if it is my OS that is screwing me up. Because I work with a lot of SQL data, I am on windows 10 not Linux. Mind if I get back to you when you officially release the new version on CRAN? Maybe by then I can just install everything through CRAN without error.

Thanks again for your quick follow up!

albertofranzin commented 3 years ago

Ok, this may be how the base R system handles packages under Windows, but I honestly do not know how if there are any differences wrt Linux so I may be completely wrong.

I will submit the package to CRAN as soon as I can, I'll ping you on this thread when I do.

Cheers

albertofranzin commented 3 years ago

Hi,

I just submitted the package to CRAN. I close this issue, feel free to reopen it or to open a new one in case of further issues.

Cheers