2.2 KiB
-
// initialization
-
W_0 \leftarrow (w_1, \dots, w_m) \leftarrow 1/m
-
W \leftarrow W_0
-
Vars \leftarrow {\cal{X}}
-
\delta \leftarrow 10^{-4}
-
convergence \leftarrow True
-
maxTolerancia \leftarrow 3
-
bisection \leftarrow False
-
error \leftarrow \inf
-
finished \leftarrow False
-
AODE \leftarrow \emptyset
// the ensemble -
tolerance \leftarrow 0
-
numModelsInPack \leftarrow 0
-
// main loop
-
While (!finished)
-
\pi \leftarrow SortFeatures(Vars, criterio, D[W])
-
if
(bisection) \; k \leftarrow 2^{tolerance} \;
elsek \leftarrow 1
-
if (
k tolerance == 0
)W_B \leftarrow W
;numItemsPack \leftarrow0
-
P \leftarrow Head(\pi,k)
// first k features in order -
spodes \leftarrow \emptyset
-
i \leftarrow 0
-
While (
i < size(P)
)-
X \leftarrow P[i]
-
i \leftarrow i + 1
-
numItemsPack \leftarrow numItemsPack + 1
-
Vars.remove(X)
-
spode \leftarrow BuildSpode(X, {\cal{X}}, D[W])
-
\hat{y}[] \leftarrow spode.Predict(D[W])
-
e \leftarrow error(\hat{y}[], y[])
-
\alpha \leftarrow \frac{1}{2} ln \left ( \frac{1-e}{e} \right )
-
if (
\alpha > 0.5
)-
finished \leftarrow True
-
break
-
-
spodes.add( (spode,\alpha_t) )
-
W \leftarrow UpdateWeights(D[W],\alpha,y[],\hat{y}[])
-
-
AODE.add( spodes )
-
if (
convergence \And ! finished
)-
\hat{y}[] \leftarrow Predict(D,spodes)
-
e \leftarrow error(\hat{y}[], y[])
-
if
(e > (error+\delta))
// result doesn't improve-
if
(tolerance == maxTolerance) \;\; finished\leftarrow True
-
else
tolerance \leftarrow tolerance+1
-
-
else
-
tolerance \leftarrow 0
-
error \leftarrow min(error,e)
-
-
-
If
(Vars == \emptyset) \; finished \leftarrow True
-
-
if (
tolerance == maxTolerance
) // algorithm finished because of lack of convergence-
removeModels(AODE, numItemsPack)
-
W \leftarrow W_B
-
-
Return
AODE