scikit-learn-contrib / py-earth

A Python implementation of Jerome Friedman's Multivariate Adaptive Regression Splines
http://contrib.scikit-learn.org/py-earth/
BSD 3-Clause "New" or "Revised" License
455 stars 121 forks source link

basis function details from the prediction ? #143

Closed adumudaliar closed 7 years ago

adumudaliar commented 7 years ago

Hello, Since MARs build a model which is weighted sum of basis functions..of the form f(x) = c1B1 + c2B2 + c3B3 + ...+ ciBi

where Bi is a Basis function and ci is a constant coefficient.

is it possible to get the individual value of ciBi for each prediction from the PyEarth implementation ?

mehdidc commented 7 years ago

Hello,

yes it is possible through the transform method. You can look here : http://contrib.scikit-learn.org/py-earth/content.html#pyearth.Earth.transform

jcrudy commented 7 years ago

@adumudaliar Yes. Adding to what @mehdidc wrote, the transform method gives your Bi's and your ci's are in the coef_ attribute. Closing, but please post if you find this doesn't work for you.