1) El documento discute los temas de ensambles, bagging, boosting y random forest. 2) Explica que los ensambles combinan múltiples modelos para mejorar el rendimiento y reducir el sesgo y la varianza. 3) Random forest aplica bagging a los árboles de decisión agregando aleatoriedad en la selección de variables para cada nodo con el fin de decorrelacionar los árboles.
5. Ensambles
Ensamble:
Conjunto de modelos que se usan juntos como un “meta
modelo”.
Idea base conocida:
Usar conocimiento de distintas fuentes al tomar decisiones.
6. Ensambles
Comité de expertos:
muchos elementos
todos con alto conocimiento
todos sobre el mismo tema
votan
Gabinete de asesores:
expertos en diferentes áreas
alto conocimiento
hay una cabeza que decide quién
sabe del tema
Ensambles planos:
-Fusión
-Bagging
-Boosting
-Random Forest
Ensambles divisivos:
-Mixture of experts
-Stacking
Crowding decision?
7. Ensambles
Dos componentes base:
Un método para seleccionar o construir los miembros
Misma o distinta área?
Distintos datasets x distintos modelos x distintas configuraciones
Un método para combinar las decisiones
Votación simple, votación ponderada, promedio, función específica,
selectividad …
8. Ensambles
Planos:
Muchos expertos, todos buenos:
Necesito que sean lo mejor posible individualmente.
De lo contrario, usualmente no sirven.
Pero necesito que opinen distinto en algunos casos.
Si todos opinan siempre igual… me quedo con uno solo!
9. Ensambles
Divisivos:
Dividir el problema en una serie de subproblemas con mínima
sobreposición.
Estrategia de “divide & conquer”.
Útiles para atacar problemas grandes.
Se necesita una función que decida que clasificador tiene que
actuar.
10. Ensambles
Si un “aprendiz” es bueno produce un buen clasificador,
puede que muchos “aprendices” produzcan algo mejor?
Por qué no aprender: { h1, h2, h3 }, entonces:
h*(x) = mayoría { h1(x), h2(x), h3(x) }
Si hi’s tienen errores independientes
h* es más precisa.
Error(hi) = ε, entonces Error(h*) = 3ε⌃2
(0.01 → 0.0003)
16. Ensambles
Un aprendiz se dice inestable si el clasificador que
produce sufre cambios importantes ante pequeñas
variaciones en los datos de entrenamiento
Inestables: árbol de decisiones, redes neuronales, …
Estables: La regresión lineal, el vecino más cercano, ...
Subsampling es mejor para los alumnos inestables
17. Ensambles
Voting Algoritms
Take an inducer and A training set,
Run the inducer multiple times by changing the distribution of the
training set instances,
The generated classifiers are combined,
… and then classify the set.
18. Ensambles
Voting algorithms can be divided into two types:
those that adaptively change the distribution of the training set
based on the performance of previous classifers (as in boosting
methods) and
those that do not (as in Bagging).
20. Bagging Algorithm
Bootstrap aggregating (Breiman 96)
Votes classifiers generated by different bootstrap samples
(replicates)
Uniformly sampling m instances from the training set with
replacement.
T bootstrap samples B1, B2, … , BT are generated and a
classfier Ci is built from each bootstrap sample Bi
A final classfier C* is built from C1, C2, … , CT whose
output is the class predicted most often by its
subclassiers, with ties broken arbitrarily
25. Bagging Algorithm
An instance instance in the training set has probability
1−(1−1/m)^m of being selected at least once in the m
times instances are randomly selected
For large m, this is about 1 − 1/e = 63.2%, which means
that each bootstrap sample contains only about 63.2%
unique instances from the training set.
If the inducer is unstable (ANN, DT), the performance can
improve.
If the inducer is stable (k-nearest neighbor), may slightly
degrade the performance.
27. Adaboost Algorithm
Boosting (Schapire 90), AdaBoost M1 (Freund & Schapire
96)
Generates the classifers sequentially, while Bagging can
generate them in parallel.
AdaBoost also changes the weights of the training
instances provided as input to each inducer based on
classifers that were previously built.
The goal is to force the inducer to minimize expected
error over diferent input distributions.
C* = weighted voting. The weight of each classfier
depends on its performance on the training set used to
build i
28. Adaboost Algorithm
The incorrect instances are weighted by a factor inversely
proportional to the error on the training set, i.e., 1/(2Ei).
Small training set errors, such as 0.1%, will cause
weights to grow by several orders of magnitude.
The AdaBoost algorithm requires a weak learning
algorithm whose error is bounded by a constant strictly
less than 1/2. In practice, the inducers we use provide no
such guarantee.
The original algorithm aborted when the error bound was
breached
Resampling + reweighting
Success (???) distribution of the “margins”
35. Adaboost : How Will Test Error Behave? (Guess!)
Expect…
training error to continue to drop (or reach 0)
test error to increase when h* becomes “too complex”
“Occam’s razor”
overfitting
36. Adaboost : How Will Test Error Behave? (Real!)
But…
test error does not increase, even after 1000 rounds
test error continues to drop, even after training error is 0!
Occam’s razor: “simpler rule is better”... appears to not apply!
37. Adaboost : Margins
key idea:
training error only measures whether classifications are right or wrong
should also consider confidence of classifications
measure confidence by margin = strength of the vote
(weighted fraction voting correctly) − (weighted fraction voting incorrectly)
38. Adaboost : Margins
key idea:
training error only measures whether classifications are right
or wrong
should also consider confidence of classifications
39. Adaboost : Application detecting Faces [Viola & Jones]
problem: find faces in photograph or movie
weak classifiers: detect light/dark rectangles in image
many clever tricks to make extremely fast and accurate
40. Adaboost : practical advantages
Fast
simple and easy to program
no parameters to tune (except T, sometimes)
flexible — can combine with any learning algorithm
no prior knowledge needed about weak learner
provably effective, given weak classifier
shift in mind set: goal now is merely to find classifiers barely
better than random guessing
Versatile
can use with data that is textual, numeric, discrete, etc.
has been extended to learning problems well beyond binary
classification
41. Adaboost : warnings
Performance of AdaBoost depends on data and weak
learner.
Consistent with theory, AdaBoost can fail if...
weak classifiers too complex
overfitting
weak classifiers too weak (γt → 0 too quickly)
underfitting
low margins
overfitting
Empirically, AdaBoost seems especially susceptible to
uniform noise.
42. Adaboost : Conclusions
Boosting is a practical tool for classification and other
learning problems
grounded in rich theory
performs well experimentally
often (but not always!) resistant to overfitting
many applications and extensions
43. Recognizing Handwritten Number
“Obvious” approach: learn F: Scribble → {0,1,2,...,9}
...doesn’t work very well (too hard!)
Or... “decompose” the learning task into 6 “subproblems”
learn 6 classifiers, one for each “sub-problem ”to classify
a new scribble:
Run each classifier
Predict the class whose code-word is closest (Hamming distance)
to the predicted code
46. Ramdom Forest: Bagging + trees
Usar bootstraps genera diversidad, pero los árboles
siguen estando muy correlacionados
Las mismas variables tienden a ocupar los primeros cortes siempre.
Ejemplo:
Dos árboles generados
con rpart a partir de
bootstraps del dataset
Pima.tr. La misma
variable está en la raíz
47. Ramdom Forest
Agregar un poco de azar al crecimiento
En cada nodo, seleccionar un grupo chico de variables al
azar y evaluar sólo esas variables.
No agrega sesgo: A la larga todas las variables entran en juego
Agrega varianza: pero eso se soluciona fácil promediando
modelos
Es efectivo para decorrelacionar los árboles
49. Ramdom Forest
Construye los árboles hasta separar todo. No hay podado.
No hay criterio de parada.
El valor de m (mtry en R) es importante. El default es
sqrt(p) que suele ser bueno.
Si uso m=p recupero bagging
El número de árboles no es importante, mientras sean
muchos. 500, 1000, 2000.
52. Ramdom Forest
Resumen
Mejora de bagging sólo para árboles
Mejores predicciones que Bagging.
Muy usado. Casi automático.
Resultados comparables a los mejores métodos actuales.
Subproductos útiles, sobre todo la estima OOB y la importancia
de variables.
54. Bagging o Boosting: El dilema sesgo-varianza
Los predictores sin sesgo tienen alta varianza (y al revés)
Hay dos formas de resolver el dilema:
Disminuir la varianza de los predictores sin sesgo
Construir muchos predictores y promediarlos: Bagging y Random
Forest
Reducir el sesgo de los predictores estables
Construir una secuencia tal que la combinación tenga menos sesgo:
Boosting
55. Sesgo y Varianza
Que funciones utilizar?
Funciones rígidas:
Buena estimación de los
parámetros óptimos – poca
flexibilidad.
Funciones flexibles:
Buen ajuste – mala estimación
de los parámetros óptimos.
Error de sesgo
Error de varianza
56. ¿Y ahora?
Las herramientas de ensamble han demostrado que
mejoran la performance de las técnicas atómicas que las
conforman.
Hay teoremas que demuestran que AdaBoost es mejor
siempre y cuando el modelo busteado tenga ciertas
características de weakness (sean limitados, no
complejos).
57. ¿Y ahora?
Corolario:
No hace falta que los votantes sean inteligentes, bien formados,
expertos, etc., basta que sean diversos y fieles a sus capacidades
limitadas.
“Un comité de tontos funciona mejor que un experto …”
¿Cómo sería un parlamento con legisladores busteados?