[R] selection of hinge function with restrictions, machine learning, earth package,
Stephen Milborrow
milbo at sonic.net
Mon Mar 14 09:46:34 CET 2011
On 2011-01-27 14:22, Rasti Matus wrote:
> I have a few questions regarding machine learning packages in R,
> e.g. earth package ...
>
> 1) How could I force the algorithm to generate knots only with
> values < 90 for variable doy?
Not possible in the current implementation. In principle it
would be possible to extend earth so the user-defined "allowed"
function includes a knot parameter. But internally in earth's C
code, the search for knots is highly optimized and any extra code in
there to possibly call a user-defined function would slow down
earth considerably.
> 2) Is it possible to restrict the algorithm to generate maximum
> number of terms per a selected variable e.g. humidity? e.g. 1
> term instead of 2?
Not possible in the current implementation. This would require
modifying earth to include an extension to the backward pass to
call a user-defined function (similar to "allowed"). That would
be a lot of work.
--------------------------------------------------------------------------------------------------------
Date: Thu, 27 Jan 2011 14:22:54 +0100
From: Rasti Matus <matus.rasti at gmail.com>
To: r-help at r-project.org
Subject: [R] selection of hinge function with restrictions, machine
learning, earth package,
Message-ID:
<AANLkTiku1a6qro7vf0a8A7cks-a=qrVS_nrRZy4_dP1B at mail.gmail.com>
Content-Type: text/plain
Hi,
I have a few questions regarding machine learning packages in R, e.g.
earth package
and its forward pass and prunning pass, and hinge functions selection in the
example below.
1) How could I force the algorithm to generate knots in hinge function only
with values < 90 for e.g. variable doy?
2) Is it possible to restrict the algorithm to generate maximum number of
terms per a selected variable e.g. humidity? e.g. 1 term instead of 2?
Thanks a lot.
rasti
>library(faraway)
>data(ozone)
>a=earth(O3~.,data=ozone)
>summary(a)
Call: earth(formula=O3~., data=ozone)
coefficients
(Intercept) 8.6910756
h(vh-5740) 0.0152607
h(5740-vh) -0.0130076
h(9-wind) 0.3044601
h(humidity-41) 0.2753048
h(humidity-54) -0.2615068
h(temp-58) 0.3801961
h(ibh-1069) -0.0006189
h(1069-ibh) -0.0029057
h(dpg-11) -0.1060948
h(80-vis) 0.0459011
h(doy-89) 0.0471836
h(89-doy) -0.1264530
h(doy-159) -0.0915781
Selected 14 of 19 terms, and 8 of 9 predictors
Importance: temp, ibh, doy, dpg, humidity, vh, vis, wind, ibt-unused
Number of terms at each degree of interaction: 1 13 (additive model)
GCV 14.85938 RSS 4134.014 GRSq 0.769177 RSq 0.8042181
[[alternative HTML version deleted]]
More information about the R-help
mailing list