pgmpy/pgmpy_tutorials

HillClimbSearch -> TypeError: __init__() got an unexpected keyword argument 'scoring_method'

Closed this issue · 1 comments

i installed with : conda install -c ankurankan pgmpy

When running:

`from pgmpy.estimators import HillClimbSearch

data = pd.DataFrame(np.random.randint(0, 3, size=(2500, 8)), columns=list('ABCDEFGH'))
data['A'] += data['B'] + data['C']
data['H'] = data['G'] - data['A']

hc = HillClimbSearch(data, scoring_method=BicScore(data))
best_model = hc.estimate()
print(best_model.edges())`

i get this:

TypeError Traceback (most recent call last)
in
6 data['H'] = data['G'] - data['A']
7
----> 8 hc = HillClimbSearch(data, scoring_method=BicScore(data))
9 best_model = hc.estimate()
10 print(best_model.edges())

~\anaconda3\envs\backtest\lib\site-packages\pgmpy\estimators\HillClimbSearch.py in init(self, data, use_cache, **kwargs)
55 self.use_cache = use_cache
56
---> 57 super(HillClimbSearch, self).init(data, **kwargs)
58
59 def _legal_operations(

~\anaconda3\envs\backtest\lib\site-packages\pgmpy\estimators\base.py in init(self, data, independencies, **kwargs)
292 self.variables = self.independencies.get_all_variables()
293
--> 294 super(StructureEstimator, self).init(data=data, **kwargs)
295
296 def estimate(self):

TypeError: init() got an unexpected keyword argument 'scoring_method'

@fritol The scoring_method argument has been moved to the estimate method so that you don't have to create new objects for trying various scoring methods.