Closed Garylee123456 closed 9 months ago
I created a new version with a temporarily fix by freezing pandas to 1.5.3. This issue occurs because iteritems is removed from pandas >= 2.0.0 but not yet incorporated into pgmpy.
Update to the latest version with: pip install -U bnlearn
When I run model = bn.structure_learning.fit(data, methodtype='tan', root_node='XX1', class_node='Y') in my Python terminal, I get the following error: AttributeError: 'Series' object has no attribute 'iteritems'. I noticed that in the function '_conditional_edge_weights_fn' in line 330 of the file located at '\venv\lib\site-packages\pgmpy\estimators\TreeSearch.py', the code still uses 'for index, marg_prob in cond_marginal.iteritems()' instead of 'for index, marg_prob in cond_marginal.items()'. After I made this change to the code, my project was able to run. Therefore, I suggest fixing the code in TreeSearch.py as mentioned above.