-
Notifications
You must be signed in to change notification settings - Fork 45
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
model.load() IndexError: list index out of range #41
Comments
Hi, could you provide more information about this problem, e.g., what is "model"? |
Thanks for your reply. Here is my complete code: |
If I don't use save-->load function, like: |
Hi, could you copy all the error messages here? It will help to locate the problem. |
Ok, here are all the error messages: File D:\Anaconda3\envs\python38\lib\site-packages\pyrca\analyzers\bayesian.py:442, in BayesianNetwork.load(cls, directory, filename, **kwargs) File D:\Anaconda3\envs\python38\lib\site-packages\pyrca\thirdparty\pgmpy\readwrite\BIF.py:90, in BIFReader.init(self, path, string, include_properties, n_jobs) File D:\Anaconda3\envs\python38\lib\site-packages\pyrca\thirdparty\pgmpy\readwrite\BIF.py:200, in BIFReader.get_variables(self) File D:\Anaconda3\envs\python38\lib\site-packages\pyparsing\results.py:193, in ParseResults.getitem(self, i) IndexError: list index out of range |
The problem comes from BIFReader. Is it OK to share the dumped .bif file so that we can examine this issue? |
I'm glad to share the .bif file. |
Thanks! You can send me email ([email protected]) or share it via Dropbox or Google drive. |
here is the google drive link: https://drive.google.com/file/d/1VPbhif8NJP3-1Y5ZkK5XonXPrYgNTbIA/view?usp=sharing |
The problem comes from the naming issue. The metric names must be English or utf-8 encoded. Otherwise, the parser of pgmpy will fail. |
I got it. So, how can I resolve the problem if my dataset must be Chinese? |
You can rename the dataframe columns as x1, x2, ..., and make a mapping from chinese names to these names. |
It's a good idea! Thanks for your guidance. I will try this method, and I am looking forward to the follow-up communication with you! |
After I save the trained model and execute model.load(), it fails with "list index out of range". Here is my code. Can you tell me what's the problem?
model.train([data_df])
model.save("model")
model = model.load("model")
The text was updated successfully, but these errors were encountered: