bnlearn icon indicating copy to clipboard operation
bnlearn copied to clipboard

Predict/inference in real time

Open Subbui opened this issue 5 years ago • 4 comments

To make predictions based on the fit method, is pickling the best approach or is there a better way to do it? Given the size of the file that is being generated with the probabilities with the fit method, making prediction/inference is taking time with pickle. Thanks

Subbui avatar Oct 28 '20 04:10 Subbui

Dear Subbui, Can you give an example?

ps I fixed to verbosity messages.

erdogant avatar Oct 28 '20 19:10 erdogant

Hi Erdogant, Thanks for prompt response. I've built a network on around 100K records with 15 variables. The file generated from the fit method(which contains all the probability numbers) was ~2GB and I wanted to use this file for inference in real time. I'm doing it with the help of pickle library right now. Every time I need to make the inference, I load the file and run the inference method to get the results. But given the size and layout of the file, it's taking few minutes to get the inference results. I wanted to understand if there is a better/faster way to do it.

Also I'm little concerned about the computational power that is needed and I'm working on reducing the cardinality of the variables and also trying to eliminate few variables(which is quite hard as all variables are handpicked and important). Please let me know your thoughts or suggest methods that I could try to deal with this.

Thanks, Subbu

Subbui avatar Oct 29 '20 03:10 Subbui

Thats indeed a huge file to store and load! But Im surprised about the size if it contains only the cpds and fitted model. Do you maybe also store the data in the pickle?

erdogant avatar Oct 29 '20 10:10 erdogant

No @erdogant . Pickle file just contains the fit method results. I've converted all the numerical variables into bins and few of the categorical variables have very high cardinality, say more than 100 and I think that's the reason for the huge output file size.

Subbui avatar Oct 29 '20 14:10 Subbui