tpot icon indicating copy to clipboard operation
tpot copied to clipboard

set_sample_weight in operator_utils.py deprecated in Python 3

Open ramppdev opened this issue 3 years ago • 0 comments

The function set_sample_weight() in operator_utils.py is using inspect.getargspec(obj.fit) in line 112. This function seems to be deprecated in Python 3 and throws an error when trying to use the fit function fit(x, y, sample_weight=weights) with sample weights. Pipelines that include for example XGBClassifier seem to be throwing a Value error, others do not throw an error.

A quick fix for this would be to replace line 112: if inspect.getargspec(obj.fit).args.count("sample_weight"): with: if "sample_weight" in inspect.getfullargspec(obj.fit).args:

This seems to be working fine for me.

ramppdev avatar Feb 23 '22 12:02 ramppdev