• Nie Znaleziono Wyników

Multiple Additive Regression Trees (MART) and their Application

N/A
N/A
Protected

Academic year: 2021

Share "Multiple Additive Regression Trees (MART) and their Application"

Copied!
14
0
0

Pełen tekst

(1)

A C T A U N I V E R S I T A T I S L O D Z I E N S I S

FO LIA O E C O N O M IC A 206, 2007

J o a nn a T rzęsiok*

M U L T IPL E ADD ITIVE R EG RESSIO N TREES (M ART) AND TH EIR APPLICATIO N

Abstract. M ultiple additive regression trees M A R T is a m ethodology for trying to solve prediction problem s in regression and classification. It’s one o f the boostin g m ethods. It w as introduced by J. H. Friedman (1999a). Besides accuracy, its primary goal is robust­ ness. It lends to be resistant against outliers, missing values, and the inclusion o f potential­ ly large num bers o f irrelevant predictor variables that have little or n o effect on the response.

In this paper the M A R T algorithm and their applications will be discussed.

Key words: m ultivariate regression, adaptive m ethod, regression trees, gradient boosting, M A R T .

1. IN T R O D U C T IO N

The subject o f the regression analysis is a set o f observations U. Each element o f this set is characterized by the vector of variables

( X {, X 2, X p, У).

We look for a function / which describes the connection between response Y and predictors X t, X 2, X p

Y = f ( X l, X 2, . . . , X p) + e (1)

where e is an error rate.

* M .Sc., Departm ent o f M athem atics, Karol Adam iecki University o f E conom ics, K ato­ wice.

(2)

The classic solution o f this problem is the least squares m ethod. In this procedure we know an analytical form of the function / and we estimate the coefficients of / , but we m ust know the distribution o f each predictor.

F o r the solving regression models the nonparam etric m ethods were introduced. In this m ethods we don’t have to know distributions o f variables X {, X 2, ..., X p. They produce models which are often better fitted to the d ata than functions obtained by the least squares m ethod. N onparam etric m odels are m ore robust and resistant against outliers (bad measurements) and missing values. The M A R T algorithm is a one o f them.

2. B O O S T IN G M E T H O D S A N D “A D A B O O S T ” A L G O R IT H M

Boosting m ethods are one of the m ost powerful learning ideas. They were originally designed for the classification problem , but later they were extended for regression.

In boosting m ethods we define the function / as a com bination of many “ weak” classifiers or functions of regression. W eak classifiers or functions o f regression have the error rate which is only slightly better than random guessing. The accuracy o f basic functions is increasing and the final model is very well fitted to the data.

“A daB oost” is one of the first and m ost popular boosting algorithms developed by Y. F r e u n d and R. S c h a p i r e (1997). This algorithm shows the idea o f boosting m ethods very well, so it will be presented in this paper.

We consider the two-class problem. The response variable Y represents the num ber of class

Y e{ — 1, 1}.

Given a vector o f predictor variables X and classifier G(X). The rate error on the training sample is

err = ^ I

! (У

1

*

°(х())

(2)

In the “A daB oost” algorithm we look for the classifiers G,(x) on the training sample

(3)

F o r the next iteration d ata are modified by applying weights w,, w2, ..., wN: • those observations that were misclassified have their weights increasing, • the weights decrease for those observations that were classified cor-The classification algorithm is reapplied to the weighted observations and we look for new classifier G2(x). This procedure is repeated M times until the accuracy o f the function doesn’t significantly improve. We build the final m odel from the sequence of classifiers Gm(x), m = 1 , 2 , M. Algorithm 1. “AdaBoost”

1. Initialize the observations weights vv{ = —, for i = 1 2. F o r m = 1,..., M:

a) fit a classifier Gm(x) to the training d ata using {w,: i = 1 b) com pute an error rate

rectly.

N

£ w, ■ I(y, Ф Gm(x))

err, i - 1 N (4)

I

c) com pute coefficients:

d) set new weights

w , * - w t - exp(am ■ I(y, Ф Gm(x))) for i - 1, N (6)

3. The final classifier has the form

(7)

The m odel (7) is a com bination o f function Gm(x). Coefficients am weigh the contribution of each respective Gm(x). The m ore accurate the classifiers in the sequence are the higher the influence of the effects becomes.

(4)

3. G E N E R A L IZ E D B O O S T IN G M O D E L

The m odel (7) m ay be generalized. The boosting m odel in a classification and regression problem takes the additive form

M

/ ( X ) = X ßm- b { \ , y m) (8)

m — 1

where ßm are the expansion coefficients and h(X, ym) are usually simple functions of m ultivariate argum ent X characterized by a set o f param e­ ters ym.

In m odel (8) we give a priori function b and we estimate param eters ßm and ym. This model is fitting to the data by minimizing a loss function L { y , f ( x )) over the training sample U:

min £ l Y У» £ ( L ■ К*» Ут) ] (9) (Ky.L-t..m*“ 1 \ « - I /

In this minimizing problem we may use: • a squared-error function

L (y ,f(x )) = ( y - f ( x ) ) 2 (10)

• an absolute-error function

L ( y , f ( * ) ) = \ y - f ( x )

I

(11)

• an exponential loss function for classification:

L ( y , f ( x ) ) = e x p ( - у ( 12)

By taking different types of loss function we get the m odel that is more or less robust.

The solution o f minimizing problem (9) is very com putationally dem an­ ding, so we use forw ard stagewise m odeling to solve it. This strategy approxim ates the param eters ym and coefficients ßm in (9) by sequentially adding new basic functions. A t each iteration we look for only a local optim al solution, but this procedure m ay lead to the final function / close to the global solution o f this task.

(5)

Algorithm 2. Forward stagewisc additive modeling 1. Initialize

/ 0(х) = 0. 2. F o r m — I , ..., M:

a) com pute ßm and ym by the minimizing the function

(ßm, Vm) = arg min £ L ( y i, f m_ l(xd + ß ' b(x„ ľ)) (13) ß.y 1-1

b) set

U x ) = f m - i ( * ) + ß m' K * > Y j (14) 3. The final m odel has the form

M

/ ( x ) = / Ai( x ) = Z ß m- b( x , y m) (15) m « 1

4. B O O S T IN G TR EES

In m odel (15) we take regression trees as a basic functions b because they have good statistical properties. They incorporate m ixtures o f numeric and categorical predictor variables. The numeric predictor variables m ay be generally m easured on very different scales. We d o n ’t need to know the distribution o f variables. Trees are also resistant.

In d ata m ining applications, usually only small fractions of the large num ber of predictor variables that have been included in the analysis are actually relevant to prediction. In models based on trees we use only these predictors which are im portant for the variable Y.

Regression trees partition the space of all jo int predictor variable values into disjoint regions Rj (for y '= 1 ,...,J ). A constant y} is assigned to each such region and the predictive rule is

x e Rj =>f ( x ) = yj for j = (16) In the regression problem we set as a constant yt the average of yt = /(x ) for x, in regions Rj

(6)

Thus the m odel (tree) can be formally expressed in the additive form

T ( x , Q ) = ' Z y J I ( x e R J) (17)

j- 1 with param eters в = {Rp yj}Jml... j.

The param eters are found by minimizing the loss function

Ś = arg min £ £ L(y„ у ) (18)

0 У- I х,еК,

The boosted tree m odel is a sum o f trees T ( x ,0 m) of the form (17)

M

/ ( x ) = £ T ( x , 0 J 0 9 )

m — 1

induced in a forw ard stagewise m anner. A t each step of this procedure we m ust solve the minimizing problem

N

@m = a rg m in ( у „ /т -,(х ,) + T ( x , 0 J ) for m = l , . . . , M (20)

e„ i - i

A t each iteration o f a forward stagewise procedure we find the region set and constants 0 m = {Rjm, yjm}jm i... jm of the next tree, given the current model /m -i(x ().

Given the regions Rjm we find the optim al constant

N

yjm = arg min Y Ь ( у „ / Я_1(х) + yJm) (21)

ti. i - i

5. M IN IM IZ IN G L O S S F U N C T IO N - ST E E PE S T D E S C E N T A L G O R IT H M

The solution o f minimizing problem (20) is also very com putationally dem anding. We find it by using one of the forw ard stagewise m anners called the steepest descent algorithm ( F r i e d m a n 1999a). A t each step of this procedure we look for th at tree T (x ,0 m), which gives the steepest descent o f loss function. This idea is also used in the M A RT algorithm .

(7)

F o r the m odel (17) loss function has the form

N

W ) = Z ^ C v A * ) ) (22)

where /( x ) = £ T ( x , ® J is a regression tree.

m — 1

The goal is to minimize L ( / ) with respect to / over the training date U. M inim izing (22) can be viewed as a numerical optim ization

where f e R N are the values o f the approxim ating function /(x ,.) at each of the N d a ta points x,

In the “ steepest descent m ethod” we want to maximally reduce a loss function, so we m ove the function L towards to the negative gradient of L. Now we fix f at

where pme R is a scalar and gme R N is a gradient of L(f). The components o f the gradient gm are

and the process is repeated at the next iteration.

The steepest descent m ethod is one of forw ard stagewise procedures. The estim ating of param eters o f the m odel in the stagewise approach is analogous to the solution in the steepest descent m ethod. A t each iteration in both algorithm s we look for function f m which m aximally reduces L.

f = arg m in L (f) (23)

f = { / ( x ,) ,/ ( x 2) , . . . , / ( x N)} (24)

L = - p m Zm for m = 1,..., M (25)

for i — 1,.... N (26)

The “ step length” pm is the solution to

Pm — arg min L(fm_ i — p • gm) for m = l , . . . , M (27)

P

The current solution is then updated

(8)

6. G R A D IE N T B O O ST IN G A N D M A R T A L G O R IT H M

M A R T - m ultiple additive regression trees - is a tree-boosting algorithm for m ultivariate regression. It was developed by J. H. F r i e d m a n (1999a). M A RT is based on the steepest descent method, so we call it gradient boosting. Algorithm 3. MART - multivariate adaptive regression trees

1. Initialize as the model f 0

/ 0(x) = arg min Х Ц у „ /( х ,))

у i « I

2. F o r m — 1,..., M:

a) for i = 1 com pute the com ponents o f gradient o f L

(29)

9 m

S L ( y „ /( x ,))'

(30)

b) fit a regression tree to the target gm giving term inal regions Rjm j c) for j — 1 J m compute 7jm = arg m in £ ЦУь/т - 1W + ľ) (31) y XjeRm) d) update /m(x) — f m ~ I(x) + Ź yjm ' Д х e Rjm) (32) y - 1

3. The final m odel has the form

/( x ) = /м (х ) + ^ ■ /(x 6 RjM) (33)

J - 1

The first line o f the algorithm initializes to the optim al constant model. Next, we com pute the com ponents of the negative gradient gim. They are referred to as “ pseudo” residuals. We fit the regression tree to the gim, update the m odel and repeat this procedure. In the end, we obtain model (33) which is very well fitted to the date.

(9)

7. E X A M PL E OF A PP L IC A T IO N O F M A R T

F o r the illustration o f the M A R T algorithm in regression we conduct com putation on the “B oston” d ata set.

D ata in the “ B oston” set were collected by P. H a r r i s o n and D. L. R u b e n f e l d (1978), who conducted research on relationships between the quality o f life and prices of property in the Boston area.

D ata in this set are characterized by twelve predictor variables: X { = C R I M - per capita crime rate by town,

X 2 = I N D U S - proportion of non-retail business acres per town, X 3 = C H A S - Charles River dummy variable (1 if tract bounds

river 0 otherwise),

X 4 = N O X - nitrogen oxides concentration (parts per 10 million), X s — R M - average num ber o f rooms,

X 6 = A G E - proportion of owner-occupied units built prior to 1940,

X 1 = DJS - weighted m ean o f distances to Boston employment centers,

X 8 = R A D - index of accessibility to radial highways, X 9 = T A X - full-value property-tax rate per 10 000 dollars, X ,0 = P T R A T I O - pupil-teacher ratio by town,

X n = B L A C K - the proportion of Afro-Americans by town, X l2 = L S T A T - lower status of the population (percent).

Response variable is У = M E D V - m edian value of owner-occupied homes in thousand dollars.

The M A R T algorithm was performed in 30 000 times (for 10 000 trees) and in a step 9851 we get the lowest test error

err = Y, LV|-/m(xí)I = 1-931.

i = 1

Figure 1 presents the average absolute test error on the set of “ Boston” data. The lower line is the training error as a function of num ber of iterations. The upper line is the corresponding test error.

M A R T introduces to the model only these predictors which have the largest influence on the response variable У. Figure 2 shows the estimated relative im portance of six predictor variables. Variable L S T A T — lower status of the population — is the m ost relevant predictor. C H A S — Charles River dum m y variable is the least im portant.

(10)

6 CU 4

i

< 2 0 0 2 000 4000 6 000 8 000 10 000 Iterations

Fig. 1. A verage absolute error as a function o f number o f iterations for the testing sample (the upper line) and training sample (the lower line)

S o u r c e : own results. CHAS RAD INDUS TAX A G E BLACK DIS NOX PTRATIO CRIM RM LSTAT i i---r --- --- 1---1--- 1 0 20 40 60 80 100 Relative importance

Fig. 2. R elative variable importance o f the predictors for the “ B o sto n ” data S o u r c e : own results.

(11)

8 CD ■O "то •■ero Q_ LSTAT RM 8. 03 ■eя Q_ CRIM PTRATIO NOX DIS

Fig. 3. Partial dependence o f housing value on the different predictors for the “ B oston ” data S o u r c e : own results.

Figure 3 displays single-variable partial dependence plots. It collects the results for the six m ost im portant predictor variables. Note th at the plots are n o t strictly smooth. This is the consequence o f using tree-based models which produce discontinuous piecewise constants models.

Figure 4 and 5 are perspective mesh plots showing the dependence of two chosen predictors on housing value in Boston.

(12)

Fig. 4. Partial dependence o f housing value on average number o f room s and lower status o f the population

S o u r c e : own results.

8.

Fig. 5. Partial dependence o f housing value on average number o f room s and pupil-teacher ratio by town

(13)

The accuracy o f the tree-based model is estimated with the help of a coefficient R 2. F o r com parison purpose, R 2 is calculated for four different models: the linear model (LN), projection pursuit regression (PPR), m ulti­ variate adaptive regression splines (M ARS) and M A R T. The results are collected in Tab. 1.

T able 1 Accuracy o f the various regression m odels

M odel LN M A R S PPR M A R T

R 2 0.779 0.780 0.883 0.988

S o u r c e : own results.

8. SU M M A R Y

M odels which are obtained by the M A R T algorithm are very well fitted to the data. We get the best accuracy for the “ B oston” d ata for the model based on the M A R T m ethod.

In d a ta m ining problems we often have a large num ber of irrelevant predictors. The M A R T algorithm selects to a model only these predictor variables which have the strongest influence on the response.

In tree-based m odel we may use and mix numerical and categorical predictor variables. We d o n ’t need to know the distribution of variables and the num eric predictors m ay be generally m easured on very different scales.

The prim ary goal o f M A R T is robustness. It tends to be resistant against outliers (bad measurements) and missing values. M A R T produces competitive, highly robust, interpretability results.

REFEREN CES

F r e u n d Y. , S c h a p i r e R. (1997), A decision-theoretic generalization o f on-line learning and

an application to boosting, “Journal o f Computer and System Sciences” , 55, 119-139.

F r i e d m a n J. H . (1999a), Greedy Function Approxim ation: A Gradient Boosting Machine

Technical R eport, D ep t, o f Statistics, Stanford University, Stanford.

F r i e d m a n J. H . (1999b), Stochastic Gradient Boosting Technical R eport, D ept, o f Statistics, Stanford U niversity, Stanford.

H a r r i s o n D. , R u b i n f e l d D . L. (1978), Hedonic Prices and the D em and f o r Clean Air, “Journal o f Environm ental Econom ics and M anagem ent”, 5, 81-102.

H a s t i e T ., T i b s h i r a n i R ., F r i e d m a n J. H. (2001), The Elem ents o f S ta tistica l Learning, Springer-Verlag, N ew York.

(14)

Joanna Trzęsiok

A D D Y T Y W N A M E T O D A B U D O W Y D R ZEW R E G R E SY JN Y C H (M A R T) I JE J Z A S T O SO W A N IE

A ddytyw na m etoda budow y drzew regresyjnych (M A R T ), została zaproponow ana przez J. H . F r i e d m a n a w 1999 r. (1999a, b). Jest to jedna z metod agregacyjnych, mająca zastosow anie w regresji i dyskryminacji opierająca się na m odelach w postaci drzew. Jej zaletam i, poza d ok ładnością predykcji, jest odporność na wartości oddalone i braki danych. Bardzo dobrze radzi sobie również z dużą liczbą zmiennych objaśniających, wśród których wiele m oże nie mieć istotnego wpływu na zmienną zależną.

W artykule przedstawiona została ogólna idea m etod agregacyjnych. Zaprezentowano i om ów ion o kolejne kroki algorytm u M A R T , a następnie, dla ilustracji, podany został przykład zastosow ania procedury M A R T dla zbioru danych „B oston ” .

Cytaty

Powiązane dokumenty

Jak zostało stwierdzone powyżej, zaufanie nie może być zredukowane do „polegania na” kimś i pozytywnej oceny jego wiarygodności; jest to raczej rodzaj otwarcia, wystawienia

In the food industry, much greater importance than the fluid whey, have whey-derived formulations such as whey powder, demineralised whey powder, whey protein concentrates

Odmowa leczenia niepłodności kobiet metodą in vitro, szeroko już sprawdzoną, jest przykładem niemoralności i religijnego zacofania lekarza. Mam jednak nadzieję, że tak

EDUKACJA BIOLOGICZNA I ŚRODOWISKOWA | ebis.ibe.edu.pl | ebis@ibe.edu.pl | © for the article by the Authors 2013 © for the edition by Instytut Badań Edukacyjnych 2013

EDUKACJA BIOLOGICZNA I ŚRODOWISKOWA | ebis.ibe.edu.pl | ebis@ibe.edu.pl | © for the article by the Authors 2013 © for the edition by Instytut Badań Edukacyjnych 2013..

We present the re- sults on (complex) extreme points, (complex) strict convexity, strong extreme points and midpoint local uniform convexity, k-extreme points and k-convexity,

Our goal is to select the observational planes that must be used in order to obtain the most exhaustive characterization of the individual sources observed, in terms of

zapisując się na kurs języka angielskiego czy też wziąć udział nawet w mniej dochodowym przedsięwzięciu z zakresu średnich czy wysokich napięć, aby zyskać odpowied-