NAG Library Routine Document
H05AAF
1 Purpose
Given a set of $m$ features and a scoring mechanism for any subset of those features, H05AAF selects the best $n$ subsets of size $p$ using a reverse communication branch and bound algorithm.
2 Specification
SUBROUTINE H05AAF ( 
IREVCM, MINCR, M, IP, NBEST, DROP, LZ, Z, LA, A, BSCORE, BZ, MINCNT, GAMMA, ACC, ICOMM, LICOMM, RCOMM, LRCOMM, IFAIL) 
INTEGER 
IREVCM, MINCR, M, IP, NBEST, DROP, LZ, Z(MIP), LA, A(max(NBEST,M)), BZ(MIP,NBEST), MINCNT, ICOMM(LICOMM), LICOMM, LRCOMM, IFAIL 
REAL (KIND=nag_wp) 
BSCORE(max(NBEST,M)), GAMMA, ACC(2), RCOMM(LRCOMM) 

3 Description
Given $\Omega =\left\{{x}_{\mathrm{i}}:i\in \mathbb{Z},1\le i\le m\right\}$, a set of $m$ unique features and a scoring mechanism $f\left(S\right)$ defined for all $S\subseteq \Omega $ then H05AAF is designed to find ${S}_{o1}\subseteq \Omega ,\left{S}_{o1}\right=p$, an optimal subset of size $p$. Here $\left{S}_{o1}\right$ denotes the cardinality of ${S}_{o1}$, the number of elements in the set.
The definition of the optimal subset depends on the properties of the scoring mechanism, if
then the optimal subset is defined as one of the solutions to
else if
then the optimal subset is defined as one of the solutions to
If neither of these properties hold then H05AAF cannot be used.
As well as returning the optimal subset,
${S}_{o1}$, H05AAF can return the best
$n$ solutions of size
$p$. If
${S}_{o\mathit{i}}$ denotes the
$\mathit{i}$th best subset, for
$\mathit{i}=1,2,\dots ,n1$, then the
$\left(i+1\right)$th best subset is defined as the solution to either
or
depending on the properties of
$f$.
The solutions are found using a branch and bound method, where each node of the tree is a subset of
$\Omega $. Assuming that
(1) holds then a particular node, defined by subset
${S}_{i}$, can be trimmed from the tree if
$f\left({S}_{i}\right)<\hat{f}\left({S}_{on}\right)$ where
$\hat{f}\left({S}_{on}\right)$ is the
$n$th highest score we have observed so far for a subset of size
$p$, i.e., our current best guess of the score for the
$n$th best subset. In addition, because of
(1) we can also drop all nodes defined by any subset
${S}_{j}$ where
${S}_{j}\subseteq {S}_{i}$, thus avoiding the need to enumerate the whole tree. Similar short cuts can be taken if
(2) holds. A full description of this branch and bound algorithm can be found in
Ridout (1988).
Rather than calculate the score at a given node of the tree H05AAF utilizes the fast branch and bound algorithm of
Somol et al. (2004), and attempts to estimate the score where possible. For each feature,
${x}_{i}$, two values are stored, a count
${c}_{i}$ and
${\hat{\mu}}_{i}$, an estimate of the contribution of that feature. An initial value of zero is used for both
${c}_{i}$ and
${\hat{\mu}}_{i}$. At any stage of the algorithm where both
$f\left(S\right)$ and
$f\left(S\left\{{x}_{i}\right\}\right)$ have been calculated (as opposed to estimated), the estimated contribution of the feature
${x}_{i}$ is updated to
and
${c}_{i}$ is incremented by
$1$, therefore at each stage
${\hat{\mu}}_{i}$ is the mean contribution of
${x}_{i}$ observed so far and
${c}_{i}$ is the number of observations used to calculate that mean.
As long as ${c}_{i}\ge k$, for the usersupplied constant $k$, then rather than calculating $f\left(S\left\{{x}_{\mathrm{i}}\right\}\right)$ this routine estimates it using $\hat{f}\left(S\left\{{x}_{\mathrm{i}}\right\}\right)=f\left(S\right)\gamma {\hat{\mu}}_{i}$ or $\hat{f}\left(S\right)\gamma {\hat{\mu}}_{i}$ if $f\left(S\right)$ has been estimated, where $\gamma $ is a usersupplied scaling factor. An estimated score is never used to trim a node or returned as the optimal score.
Setting
$k=0$ in this routine will cause the algorithm to always calculate the scores, returning to the branch and bound algorithm of
Ridout (1988). In most cases it is preferable to use the fast branch and bound algorithm, by setting
$k>0$, unless the score function is iterative in nature, i.e.,
$f\left(S\right)$ must have been calculated before
$f\left(S\left\{{x}_{i}\right\}\right)$ can be calculated.
4 References
Narendra P M and Fukunaga K (1977) A branch and bound algorithm for feature subset selection IEEE Transactions on Computers 9 917–922
Ridout M S (1988) Algorithm AS 233: An improved branch and bound algorithm for feature subset selection Journal of the Royal Statistics Society, Series C (Applied Statistics) (Volume 37) 1 139–147
Somol P, Pudil P and Kittler J (2004) Fast branch and bound algorithms for optimal feature selection IEEE Transactions on Pattern Analysis and Machine Intelligence (Volume 26) 7 900–912
5 Parameters
Note: this routine uses
reverse communication. Its use involves an initial entry, intermediate exits and reentries, and a final exit, as indicated by the parameter
IREVCM. Between intermediate exits and reentries,
all parameters other than BSCORE must remain unchanged.
 1: $\mathrm{IREVCM}$ – INTEGERInput/Output

On initial entry: must be set to $0$.
On intermediate exit:
${\mathbf{IREVCM}}=1$ and before reentry the scores associated with
LA subsets must be calculated and returned in
BSCORE.
The
LA subsets are constructed as follows:
 ${\mathbf{DROP}}=1$
 The $j$th subset is constructed by dropping the features specified in the first LZ elements of Z and the single feature given in ${\mathbf{A}}\left(j\right)$ from the full set of features, $\Omega $. The subset will therefore contain ${\mathbf{M}}{\mathbf{LZ}}1$ features.
 ${\mathbf{DROP}}=0$
 The $j$th subset is constructed by adding the features specified in the first LZ elements of Z and the single feature specified in ${\mathbf{A}}\left(j\right)$ to the empty set, $\varnothing $. The subset will therefore contain ${\mathbf{LZ}}+1$ features.
In both cases the individual features are referenced by the integers
$1$ to
M with
$1$ indicating the first feature,
$2$ the second, etc., for some arbitrary ordering of the features. The same ordering must be used in all calls to H05AAF.
If
${\mathbf{LA}}=0$, the score for a single subset should be returned. This subset is constructed by adding or removing only those features specified in the first
LZ elements of
Z.
If ${\mathbf{LZ}}=0$, this subset will either be $\Omega $ or $\varnothing $.
The score associated with the $j$th subset must be returned in ${\mathbf{BSCORE}}\left(j\right)$.
On intermediate reentry:
IREVCM must remain unchanged.
On final exit: ${\mathbf{IREVCM}}=0$, and the algorithm has terminated.
Constraint:
${\mathbf{IREVCM}}=0$ or $1$.
 2: $\mathrm{MINCR}$ – INTEGERInput

On entry: flag indicating whether the scoring function
$f$ is increasing or decreasing.
 ${\mathbf{MINCR}}=1$
 $f\left({S}_{i}\right)\le f\left({S}_{j}\right)$, i.e., the subsets with the largest score will be selected.
 ${\mathbf{MINCR}}=0$
 $f\left({S}_{i}\right)\ge f\left({S}_{j}\right)$, i.e., the subsets with the smallest score will be selected.
For all
${S}_{j}\subseteq \Omega $ and
${S}_{i}\subseteq {S}_{j}$.
Constraint:
${\mathbf{MINCR}}=0$ or $1$.
 3: $\mathrm{M}$ – INTEGERInput

On entry: $m$, the number of features in the full feature set.
Constraint:
${\mathbf{M}}\ge 2$.
 4: $\mathrm{IP}$ – INTEGERInput

On entry: $p$, the number of features in the subset of interest.
Constraint:
$1\le {\mathbf{IP}}\le {\mathbf{M}}$.
 5: $\mathrm{NBEST}$ – INTEGERInput

On entry:
$n$, the maximum number of best subsets required. The actual number of subsets returned is given by
LA on final exit. If on final exit
${\mathbf{LA}}\ne {\mathbf{NBEST}}$ then
${\mathbf{IFAIL}}={\mathbf{53}}$ is returned.
Constraint:
${\mathbf{NBEST}}\ge 1$.
 6: $\mathrm{DROP}$ – INTEGERInput/Output

On initial entry:
DROP need not be set.
On intermediate exit:
flag indicating whether the intermediate subsets should be constructed by dropping features from the full set (
${\mathbf{DROP}}=1$) or adding features to the empty set (
${\mathbf{DROP}}=0$). See
IREVCM for details.
On intermediate reentry:
DROP must remain unchanged.
On final exit:
DROP is undefined.
 7: $\mathrm{LZ}$ – INTEGERInput/Output

On initial entry:
LZ need not be set.
On intermediate exit:
the number of features stored in
Z.
On intermediate reentry:
LZ must remain unchanged.
On final exit:
LZ is undefined.
 8: $\mathrm{Z}\left({\mathbf{M}}{\mathbf{IP}}\right)$ – INTEGER arrayInput/Output

On initial entry:
Z need not be set.
On intermediate exit:
${\mathbf{Z}}\left(\mathit{i}\right)$, for
$\mathit{i}=1,2,\dots ,{\mathbf{LZ}}$, contains the list of features which, along with those specified in
A, define the subsets whose score is required. See
IREVCM for additional details.
On intermediate reentry:
Z must remain unchanged.
On final exit:
Z is undefined.
 9: $\mathrm{LA}$ – INTEGERInput/Output

On initial entry:
LA need not be set.
On intermediate exit:
if
${\mathbf{LA}}>0$, the number of subsets for which a score must be returned.
If
${\mathbf{LA}}=0$, the score for a single subset should be returned. See
IREVCM for additional details.
On intermediate reentry:
LA must remain unchanged.
On final exit: the number of best subsets returned.
 10: $\mathrm{A}\left(\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{NBEST}},{\mathbf{M}}\right)\right)$ – INTEGER arrayInput/Output

On initial entry:
A need not be set.
On intermediate exit:
${\mathbf{A}}\left(\mathit{j}\right)$, for
$\mathit{j}=1,2,\dots ,{\mathbf{LA}}$, contains the list of features which, along with those specified in
Z, define the subsets whose score is required. See
IREVCM for additional details.
On intermediate reentry:
A must remain unchanged.
On final exit:
A is undefined.
 11: $\mathrm{BSCORE}\left(\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{NBEST}},{\mathbf{M}}\right)\right)$ – REAL (KIND=nag_wp) arrayInput/Output

On initial entry:
BSCORE need not be set.
On intermediate exit:
BSCORE is undefined.
On intermediate reentry:
${\mathbf{BSCORE}}\left(j\right)$ must hold the score for the
$j$th subset as described in
IREVCM.
On final exit: holds the score for the
LA best subsets returned in
BZ.
 12: $\mathrm{BZ}\left({\mathbf{M}}{\mathbf{IP}},{\mathbf{NBEST}}\right)$ – INTEGER arrayInput/Output

On initial entry:
BZ need not be set.
On intermediate exit:
BZ is used for storage between calls to H05AAF.
On intermediate reentry:
BZ must remain unchanged.
On final exit: the $j$th best subset is constructed by dropping the features specified in
${\mathbf{BZ}}\left(\mathit{i},\mathit{j}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{M}}{\mathbf{IP}}$ and $\mathit{j}=1,2,\dots ,{\mathbf{LA}}$, from the set of all features, $\Omega $. The score for the $j$th best subset is given in ${\mathbf{BSCORE}}\left(j\right)$.
 13: $\mathrm{MINCNT}$ – INTEGERInput

On entry:
$k$, the minimum number of times the effect of each feature,
${x}_{i}$, must have been observed before
$f\left(S\left\{{x}_{i}\right\}\right)$ is estimated from
$f\left(S\right)$ as opposed to being calculated directly.
If $k=0$ then $f\left(S\left\{{x}_{i}\right\}\right)$ is never estimated. If ${\mathbf{MINCNT}}<0$ then $k$ is set to $1$.
 14: $\mathrm{GAMMA}$ – REAL (KIND=nag_wp)Input

On entry: $\gamma $, the scaling factor used when estimating scores. If ${\mathbf{GAMMA}}<0$ then $\gamma =1$ is used.
 15: $\mathrm{ACC}\left(2\right)$ – REAL (KIND=nag_wp) arrayInput

On entry: a measure of the accuracy of the scoring function,
$f$.
Letting
${a}_{i}={\epsilon}_{1}\leftf\left({S}_{i}\right)\right+{\epsilon}_{2}$, then when confirming whether the scoring function is strictly increasing or decreasing (as described in
MINCR), or when assessing whether a node defined by subset
${S}_{i}$ can be trimmed, then any values in the range
$f\left({S}_{i}\right)\pm {a}_{i}$ are treated as being numerically equivalent.
If $0\le {\mathbf{ACC}}\left(1\right)\le 1$ then ${\epsilon}_{1}={\mathbf{ACC}}\left(1\right)$, otherwise ${\epsilon}_{1}=0$.
If ${\mathbf{ACC}}\left(2\right)\ge 0$ then ${\epsilon}_{2}={\mathbf{ACC}}\left(2\right)$, otherwise ${\epsilon}_{2}=0$.
In most situations setting both ${\epsilon}_{1}$ and ${\epsilon}_{2}$ to zero should be sufficient. Using a nonzero value, when one is not required, can significantly increase the number of subsets that need to be evaluated.
 16: $\mathrm{ICOMM}\left({\mathbf{LICOMM}}\right)$ – INTEGER arrayCommunication Array

On initial entry:
ICOMM need not be set.
On intermediate exit:
ICOMM is used for storage between calls to H05AAF.
On intermediate reentry:
ICOMM must remain unchanged.
On final exit:
ICOMM is not defined. The first two elements,
${\mathbf{ICOMM}}\left(1\right)$ and
${\mathbf{ICOMM}}\left(2\right)$ contain the minimum required value for
LICOMM and
LRCOMM respectively.
 17: $\mathrm{LICOMM}$ – INTEGERInput

On entry: the length of the array
ICOMM. If
LICOMM is too small and
${\mathbf{LICOMM}}\ge 2$ then
${\mathbf{IFAIL}}={\mathbf{172}}$ is returned and the minimum value for
LICOMM and
LRCOMM are given by
${\mathbf{ICOMM}}\left(1\right)$ and
${\mathbf{ICOMM}}\left(2\right)$ respectively.
Constraints:
 if ${\mathbf{MINCNT}}=0\phantom{\rule{0ex}{0ex}}$, ${\mathbf{LICOMM}}\ge 2\times \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{NBEST}},{\mathbf{M}}\right)+{\mathbf{M}}\left({\mathbf{M}}+2\right)+\left({\mathbf{M}}+1\right)\times \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}}{\mathbf{IP}},1\right)+27$;
 otherwise ${\mathbf{LICOMM}}\ge 2\times \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{NBEST}},{\mathbf{M}}\right)+{\mathbf{M}}\left({\mathbf{M}}+3\right)+\left(2{\mathbf{M}}+1\right)\times \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}}{\mathbf{IP}},1\right)+25$.
 18: $\mathrm{RCOMM}\left({\mathbf{LRCOMM}}\right)$ – REAL (KIND=nag_wp) arrayCommunication Array

On initial entry:
RCOMM need not be set.
On intermediate exit:
RCOMM is used for storage between calls to H05AAF.
On intermediate reentry:
RCOMM must remain unchanged.
On final exit:
RCOMM is not defined.
 19: $\mathrm{LRCOMM}$ – INTEGERInput

On entry: the length of the array
RCOMM. If
LRCOMM is too small and
${\mathbf{LICOMM}}\ge 2$ then
${\mathbf{IFAIL}}={\mathbf{172}}$ is returned and the minimum value for
LICOMM and
LRCOMM are given by
${\mathbf{ICOMM}}\left(1\right)$ and
${\mathbf{ICOMM}}\left(2\right)$ respectively.
Constraints:
 if ${\mathbf{MINCNT}}=0$, ${\mathbf{LRCOMM}}\ge 9+{\mathbf{NBEST}}+{\mathbf{M}}\times \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}}{\mathbf{IP}},1\right)$;
 otherwise ${\mathbf{LRCOMM}}\ge 8+{\mathbf{M}}+{\mathbf{NBEST}}+{\mathbf{M}}\times \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{M}}{\mathbf{IP}},1\right)$.
 20: $\mathrm{IFAIL}$ – INTEGERInput/Output

On initial entry:
IFAIL must be set to
$0$,
$1\text{ or}1$. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
$1\text{ or}1$ is recommended. If the output of error messages is undesirable, then the value
$1$ is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
${\mathbf{IFAIL}}\ne {\mathbf{0}}$ on exit, the recommended value is
$1$.
When the value $\mathbf{1}\text{ or}1$ is used it is essential to test the value of IFAIL on exit.
On final exit:
${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${{\mathbf{1}}}$, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
 ${\mathbf{IFAIL}}=11$

On entry, ${\mathbf{IREVCM}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{IREVCM}}=0$ or $1$.
 ${\mathbf{IFAIL}}=21$

On entry, ${\mathbf{MINCR}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{MINCR}}=0$ or $1$.
 ${\mathbf{IFAIL}}=22$

MINCR has changed between calls.
On intermediate entry,
${\mathbf{MINCR}}=\u2329\mathit{\text{value}}\u232a$.
On initial entry,
${\mathbf{MINCR}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=31$

On entry, ${\mathbf{M}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{M}}\ge 2$.
 ${\mathbf{IFAIL}}=32$

M has changed between calls.
On intermediate entry,
${\mathbf{M}}=\u2329\mathit{\text{value}}\u232a$.
On initial entry,
${\mathbf{M}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=41$

On entry, ${\mathbf{IP}}=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{M}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: $1\le {\mathbf{IP}}\le {\mathbf{M}}$.
 ${\mathbf{IFAIL}}=42$

IP has changed between calls.
On intermediate entry,
${\mathbf{IP}}=\u2329\mathit{\text{value}}\u232a$.
On initial entry,
${\mathbf{IP}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=51$

On entry, ${\mathbf{NBEST}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{NBEST}}\ge 1$.
 ${\mathbf{IFAIL}}=52$

NBEST has changed between calls.
On intermediate entry,
${\mathbf{NBEST}}=\u2329\mathit{\text{value}}\u232a$.
On initial entry,
${\mathbf{NBEST}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=53$

On entry, ${\mathbf{NBEST}}=\u2329\mathit{\text{value}}\u232a$.
But only $\u2329\mathit{\text{value}}\u232a$ best subsets could be calculated.
 ${\mathbf{IFAIL}}=61$

DROP has changed between calls.
On intermediate entry,
${\mathbf{DROP}}=\u2329\mathit{\text{value}}\u232a$.
On initial entry,
${\mathbf{DROP}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=71$

LZ has changed between calls.
On entry,
${\mathbf{LZ}}=\u2329\mathit{\text{value}}\u232a$.
On previous exit,
${\mathbf{LZ}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=91$

LA has changed between calls.
On entry,
${\mathbf{LA}}=\u2329\mathit{\text{value}}\u232a$.
On previous exit,
${\mathbf{LA}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=111$

${\mathbf{BSCORE}}\left(\u2329\mathit{\text{value}}\u232a\right)=\u2329\mathit{\text{value}}\u232a$, which is inconsistent with the score for the parent node. Score for the parent node is $\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=131$

MINCNT has changed between calls.
On intermediate entry,
${\mathbf{MINCNT}}=\u2329\mathit{\text{value}}\u232a$.
On initial entry,
${\mathbf{MINCNT}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=141$

GAMMA has changed between calls.
On intermediate entry,
${\mathbf{GAMMA}}=\u2329\mathit{\text{value}}\u232a$.
On initial entry,
${\mathbf{GAMMA}}=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=151$

${\mathbf{ACC}}\left(1\right)$ has changed between calls.
On intermediate entry, ${\mathbf{ACC}}\left(1\right)=\u2329\mathit{\text{value}}\u232a$.
On initial entry, ${\mathbf{ACC}}\left(1\right)=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=152$

${\mathbf{ACC}}\left(2\right)$ has changed between calls.
On intermediate entry, ${\mathbf{ACC}}\left(2\right)=\u2329\mathit{\text{value}}\u232a$.
On initial entry, ${\mathbf{ACC}}\left(2\right)=\u2329\mathit{\text{value}}\u232a$.
 ${\mathbf{IFAIL}}=161$

ICOMM has been corrupted between calls.
 ${\mathbf{IFAIL}}=171$

On entry,
${\mathbf{LICOMM}}=\u2329\mathit{\text{value}}\u232a$,
${\mathbf{LRCOMM}}=\u2329\mathit{\text{value}}\u232a$.
Constraint:
${\mathbf{LICOMM}}\ge \u2329\mathit{\text{value}}\u232a$,
${\mathbf{LRCOMM}}\ge \u2329\mathit{\text{value}}\u232a$.
ICOMM is too small to return the required array sizes.
 ${\mathbf{IFAIL}}=172$

On entry,
${\mathbf{LICOMM}}=\u2329\mathit{\text{value}}\u232a$,
${\mathbf{LRCOMM}}=\u2329\mathit{\text{value}}\u232a$.
Constraint:
${\mathbf{LICOMM}}\ge \u2329\mathit{\text{value}}\u232a$,
${\mathbf{LRCOMM}}\ge \u2329\mathit{\text{value}}\u232a$.
The minimum required values for
LICOMM and
LRCOMM are returned in
${\mathbf{ICOMM}}\left(1\right)$ and
${\mathbf{ICOMM}}\left(2\right)$ respectively.
 ${\mathbf{IFAIL}}=181$

RCOMM has been corrupted between calls.
 ${\mathbf{IFAIL}}=99$
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
 ${\mathbf{IFAIL}}=399$
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
 ${\mathbf{IFAIL}}=999$
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
7 Accuracy
The subsets returned by H05AAF are guaranteed to be optimal up to the accuracy of your calculated scores.
8 Parallelism and Performance
H05AAF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementationspecific information.
The maximum number of unique subsets of size
$p$ from a set of
$m$ features is
$N=\frac{m!}{\left(mp\right)!p!}$. The efficiency of the branch and bound algorithm implemented in H05AAF comes from evaluating subsets at internal nodes of the tree, that is subsets with more than
$p$ features, and where possible trimming branches of the tree based on the scores at these internal nodes as described in
Narendra and Fukunaga (1977). Because of this it is possible, in some circumstances, for more than
$N$ subsets to be evaluated. This will tend to happen when most of the features have a similar effect on the subset score.
If multiple optimal subsets exist with the same score, and
NBEST is too small to return them all, then the choice of which of these optimal subsets is returned is arbitrary.
10 Example
This example finds the three linear regression models, with five variables, that have the smallest residual sums of squares when fitted to a supplied dataset. The data used in this example was simulated.
10.1 Program Text
Program Text (h05aafe.f90)
10.2 Program Data
Program Data (h05aafe.d)
10.3 Program Results
Program Results (h05aafe.r)