Getting Started with NNS: Classification

Fred Viole



NNS.reg is a very robust regression technique capable of nonlinear regressions of continuous variables and classification tasks in machine learning problems.

We have extended the NNS.reg applications per the use of an ensemble method of classification in NNS.boost.

One major advantage NNS.boost has over tree based methods is the ability to seamlessly extrapolate beyond the current range of observations.

Splits vs. Partitions

Popular boosting algorithms take a series of weak learning decision tree models, and aggregate their outputs. NNS is also a decision tree of sorts, by partitioning each regressor with respect to the dependent variable. We can directly control the number of “splits” with the NNS.reg(..., order = , ...) parameter.

NNS Partitions

We can see how NNS partitions each regressor by calling the $rhs.partitions output. You will notice that each partition is not an equal interval, nor of equal length, which differentiates NNS from other bandwidth or tree-based techniques.

Higher dependence between a regressor and the dependent variable will allow for a larger number of partitions. This is determined internally with the NNS.dep measure.

##    Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1:     4.300000    2.000000     1.000000   0.1000000
## 2:     4.749375    2.376506     1.221875   0.2383333
## 3:     5.198750    2.753012     1.443750   0.3766667
## 4:     6.580000    3.434328     3.077778   1.7477778
## 5:     7.240000    3.917164     4.466667   2.1238889
## 6:     7.900000    4.400000     5.688095   2.5000000
## 7:           NA          NA     6.294048          NA
## 8:           NA          NA     6.900000          NA


Through resampling of the training set and letting each iterated set of data speak for themselves (while paying extra attention to the residuals throughout), we can test various regressor combinations in these dynamic decision trees…only keeping those combinations that add predictive value. From there we simply aggregate the predictions.

NNS.boost will automatically search for an accuracy threshold from the training set, reporting iterations remaining and level obtained in the console. A plot of the frequency of the learning accuracy on the training set is also provided.

Once a threshold is obtained, NNS.boost will test various feature combinations against different splits of the training set and report back the frequency of each regressor used in the final estimate.

Let’s have a look and see how it works. We use 140 random iris observations as our training set and 10 observations as our test set.

test.set = sample(150,10)

a = NNS.boost(iris[-test.set, 1:4], iris[-test.set, 5],
              IVs.test = iris[test.set, 1:4],
              epochs = 100, learner.trials = 100, status = FALSE,
              ncores = 1, subcores = 1)

## [1] 1
## Sepal.Length  Sepal.Width Petal.Length  Petal.Width 
##    0.2452830    0.2075472    0.2830189    0.2641509

A perfect classification.

Brief Notes on Other Parameters


If the user is so motivated, detailed arguments further examples are provided within the following: