performance: Performance Evaluation

Description Usage Arguments Details Author(s) Examples

View source: R/performance.R

Description

Evaluate the performance of classification model.

Usage

1
2
  
  performance(predictClass,factClass)

Arguments

predictClass

a factor of predicted classifications of training set, comprising of "-1" or "+1".

factClass

a vector of true classifications of training set, comprising of "-1" or "+1".

Details

performance evaluates the performance of classification model. It cacluates: tp (true positive), tn(ture negative), fp(false positive), fn(false negative), prc(precision), sn(sensitivity), sp(specificity), acc(accuracy), mcc(Matthews Correlation Coefficient), pc(Performance Coefficient).

Author(s)

Hong Li

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
  ## read positive/negative sequence from files.
  tmpfile1 = file.path(path.package("BioSeqClass"), "example", "acetylation_K.pos40.pep")
  tmpfile2 = file.path(path.package("BioSeqClass"), "example", "acetylation_K.neg40.pep")
  posSeq = as.matrix(read.csv(tmpfile1,header=FALSE,sep="\t",row.names=1))[,1]
  negSeq = as.matrix(read.csv(tmpfile2,header=FALSE,sep="\t",row.names=1))[,1]
  data = data.frame(rbind(featureBinary(posSeq,elements("aminoacid")), 
       featureBinary(negSeq,elements("aminoacid")) ),
       class=c(rep("+1",length(posSeq)),
       rep("-1",length(negSeq))) )
  
  ## sample train and test data
  tmp = c(sample(1:length(posSeq),length(posSeq)*0.8), 
    sample(length(posSeq)+(1:length(negSeq)),length(negSeq)*0.8))
  train = data[tmp,]
  test = data[-tmp,]
  
  ## Build classification model using training data
  model1 = classifyModelLIBSVM(train,svm.kernel="linear",svm.scale=FALSE)
  ## Predict test data by classification model
  testClass = predict(model1, test[,-ncol(test)])
  ## Evaluate the performance of classification model
  performance(testClass,test[,ncol(test)])

BioSeqClass documentation built on April 28, 2020, 9:19 p.m.