esknnProb: Train the ensemble of subset of k-nearest neighbours...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/esknnProb.R

Description

This function selects a subset of optimal models from a set of m models, initially generated on bootstrap sample with a random feature subset from the training data, for class membership probability estimation. The values for the hyper parameters, for example subset size of the best models from the total initial m models, can be specified by the user otherwise the default values are considered.

Usage

1
esknnProb(xtrain, ytrain, k = NULL, q = NULL, m = NULL, ss = NULL)

Arguments

xtrain

A matrix or data frame of size n x d dimension where n is the number of traing observation and d is the number of features.

ytrain

A vector of class labels for the training data. Class labels should be factor of two levels (0,1) represented by variable Class in the data.

k

Number of nearest neighbours to be considered, when NULL then the default is set tok=3.

q

Percent of models to be selected from the initial set m.

m

Number of models to be generated in the first stage, when NULL the default is m=501.

ss

Feature subset size to be selected from d features for each bootstrap sample, when NULL the default is (number of features)/3.

Value

trainfinal

List of the extracted opimal models.

fsfinal

List of the features used in each selected models.

Author(s)

Asma Gul <agul@essex.ac.uk>

References

Gul, A., Perperoglou, A., Khan, Z., Mahmoud, O.,Miftahuddin, M., Adler, W. and Lausen, B.(2014),Ensemble of Subset of kNN Classifiers, Journal name to appear.

See Also

Predict.esknnProb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Load the data

  data(sonar)
  data <- sonar

# Divide the data into testing and training

  Class <- data[,names(data)=="Class"]
  data$Class<-as.factor(as.numeric(Class)-1)
  train <- data[sample(1:nrow(data),0.7*nrow(data)),]
  test <- data[-(sample(1:nrow(data),0.7*nrow(data))),]
  ytrain<-train[,names(train)=="Class"]
  xtrain<-train[,names(train)!="Class"]
  xtest<-test[,names(test)!="Class"]
  ytest <- test[,names(test)=="Class"]

# Trian esknnProb on training data

  model<-esknnProb(xtrain, ytrain,k=NULL)

# Predict on test data

  resProb<-Predict.esknnProb(model,xtest,ytest,k=NULL)

## Returning Objects

  resProb$PredProb
  resProb$BrierScore

ESKNN documentation built on May 2, 2019, 6:25 a.m.