Multivariate adaptive regression splines (MARS) is a non-parametric regression method that extends a linear model with non-linear interactions.
This module borrows the implementation of the technique from the Earth R package by Stephen Milborrow.
Example
>>> import Orange
>>> data = Orange.data.Table("housing")
>>> c = Orange.regression.earth.EarthLearner(data, degree=2, terms=10)
>>> print c
MEDV =
23.587
+11.896 * max(0, RM - 6.431)
+1.142 * max(0, 6.431 - RM)
-0.612 * max(0, LSTAT - 6.120)
-228.795 * max(0, NOX - 0.647) * max(0, RM - 6.431)
+0.023 * max(0, TAX - 307.000) * max(0, 6.120 - LSTAT)
+0.029 * max(0, 307.000 - TAX) * max(0, 6.120 - LSTAT)
Earth learner class. Supports both regression and classification problems. For classification, class values are expanded into continuous indicator columns (one for each value if the number of values is grater then 2), and a multi response model is fit to these new columns. The resulting classifier the computes response values on new instances to select the final predicted class.
Earth classifier.
Return a list of features for the included Earth terms. The attributes can be used in Orange’s domain translation (i.e. they define the proper get_value_from functions).
Return the base matrix (bx) of the Earth model for the table. If table is not supplied, the base matrix of the training instances is returned. Base matrix is a len(instances) x num_terms matrix of computed values of terms in the model (not multiplied by beta) for each instance.
Parameters: | instances (Orange.data.Table) – Input instances for the base matrix. |
---|
Return the estimated variable importances.
Parameters: | used_only – if True return only used attributes |
---|
Predict the response value(s)
Parameters: | instance (Orange.data.Instance) – Data instance |
---|
Return a string representation of the model.
Return the generalized cross validation.
Parameters: |
|
---|
Plot the variable importances as returned from EarthClassifier.evimp call.
import Orange
data = Orange.data.Table("housing")
c = Orange.regression.earth.EarthLearner(data, degree=3)
Orange.regression.earth.plot_evimp(c.evimp())
The left axis is the nsubsets measure and on the right are the normalized RSS and GCV.
Extract combined (average) evimp from an instance of BaggedClassifier
Example:
from Orange.ensemble.bagging import BaggedLearner
bc = BaggedLearner(EarthLearner(degree=3, terms=10), data)
bagged_evimp(bc)
A subclass of Orange.feature.scoring.Score that. scores features based on their importance in the Earth model using bagged_evimp.
import Orange
l1 = Orange.multitarget.earth.EarthLearner(name="earth")
l2 = Orange.multitarget.binary.BinaryRelevanceLearner(
learner = Orange.regression.mean.MeanLearner, name = "Majority")
learners = [l1, l2]
# PLSClassifier do not work with missing values, the missing values need to be imputed
data = Orange.data.Table('multitarget-synthetic')
results = Orange.evaluation.testing.cross_validation(learners, data, 3)
print "Regression - multitarget-synthetic.tab"
print "%18s %6s" % ("Learner ", "RMSE")
for i in range(len(learners)):
print "%18s %1.4f" % (learners[i].name,
Orange.multitarget.scoring.mt_average_score(results, Orange.evaluation.scoring.RMSE)[i])