Closed miele100 closed 5 years ago
@miele100 There must have been some kind of change. Did you update Python or some other packages? Were you using a Python installed by your operating system that might have suffered an automatic update? Also, can you tell me what is printing when you attempt? Is it just nothing? I'm asking because I'm not sure what caused your issue and I want to figure out if it's going to affect other people.
Regardless of the above, I would suggest trying:
print(repr(model.summary())
and
print(str(model.summary())
Perhaps one of those will fix your problem. If they don't, will you please respond with whatever output you are seeing?
I made no updates, so it was odd to me that it just stopped working. Thank you for the suggestions. Both result in this syntax error:
print(str(model.summary())
File "
print(model.trace()) does not result in error, it returns forward pass and pruning pass results.
print (model.summary) results in a list of the parameters.
Here is the error from print(model.summary()) : print (model.summary()) Traceback (most recent call last):
File "
File "C:\Users\username\Anaconda3\lib\site-packages\pyearth\earth.py", line 919, in summary data.append([str(bf), 'Yes' if bf.is_pruned() else 'No'] + [
File "pyearth/_basis.pyx", line 883, in pyearth._basis.LinearBasisFunction.str
TypeError: unsupported operand type(s) for +=: 'int' and 'str'
Also, model.mse_, model.rsq, etc. seem to work just fine.
@miele100 I mismatched the parentheses in those print statements. If you fix them it will fix the syntax error. However, based on your traceback, it looks like the labels in your basis functions are for some reason integers instead of strings. Would it be possible to share your entire script? I would also say that this is a bug in py-earth, since I think py-earth should be able to handle this situation, so I'm marking this issue as a bug.
Yes that was it. I switched scaling functions (I used one from sklearn preprocessing) and it transformed the column headers into integers. When I replaced the integers with the original column headers it worked fine. Thank you!!!
This should be fixed in branch v0.2dev as of 7d296fa33f6aea7259eecab3fc020101b2568f0c. Closing.
suddenly without changes to the model, the model basis is not printing when I use: print(model.trace()) print(model.summary()) (I don't recall whether it printed at end of trace or with summary...but it was working fine and just suddenly stopped printing)
also, with model.basis_ I receive this: <pyearth._basis.Basis at 0x21d8d8c26c8> This wasn't what I was expecting...
I was able to get an output with one of the functions in the export file - export_python_string(earth_model, function_name="model") - however I'm not confident in interpreting this output correctly.
I've tried replacing the earth file with a new one, and reinstalling pyearth. So far the best I have is the export output. I'm looking for the basis summary that lists the variables in relation to constant, coefficient and pruning pass result. Any thoughts? Thank you!