-
Notifications
You must be signed in to change notification settings - Fork 123
Unable to fit Earth() over multiple X variables #225
Comments
@kchoX14 If you are refitting your model multiple times you will run into this error -- see this issue #198. This project is largely abandoned so I wouldn't expect any resolution to your question. My advise would be to try a different algorithm to model you data or use the R package, which is still supported. |
That is indeed very sad... MARS is powerful for predicting nonlinearity. It's a shame that the code isn't capable of dealing with multiple linear regressions (the foundation of MARS is multivariate). Sigh! |
@kchoX14 I don't understand your comment. By it's very nature it is multivariate. However, if you are trying to refit the model multiple times, you will need to subset the dataset each time |
Each row from 1 to m represents a regression in multiple variables (1 to n). So, the ideal requirement from pyearth is that it fits for every such candidate basis and then it gets passed to, I don't know, say a repeated cross-validation against the model. Right now, this only works when n=1. n > 1 fails terribly, and that is the precise requirement to check against multiple linear regression, not its simple sibling. |
This project needs to be worked into, in order to fix and provide a fully functional MARS over python. |
It should work just fine with multiple columns in This part confuses me:
Do you mean your data is really 3D? That is probably not supported; what should the MARS algorithm be doing on such data? |
Reading through the observed error lines, I don't see how this could happen unless as @kevin-dietz says, you fitted the same instance of |
I'm using Python v3.7.5 on Windows 10 over Jupyter notebook.
pandas.core.series.Series
instance of (m,) shape.pyearth
against thestatsmodel.api
ordinary least squares fitting, where Y is linearly regressed against all the "n" X variables.model = Earth()
results = model.fit(X,Y)
print(results)
It returns from line 424 of earth.py:
ValueError: Wrong number of columns in X. Reshape your data
I've even tried the transpose of the arrays X and Y. Nothing works, and the error is the same. Further highlighted, internal errors are:
--> 611 X, y, sample_weight, output_weight, missing)
--> 465 X, missing = self._scrub_x(X, missing, **kwargs)
Question:
What is going on here? Can't
pyearth
accept multiple variables? MARS is supposed to be "multivariate" adaptive regression splining, after all. Or am I doing something wrong?The text was updated successfully, but these errors were encountered: