def classifierWrapper(classifier, classifierType, testSample):
 R = (-1)
 P = (-1)
 if (classifierType == 'knn'):
  [R, P] = classifier.classify(testSample)
 elif ((classifierType == 'svm') or (classifierType == 'randomforest') or (classifierType == 'gradientboosting') or 'extratrees'):
  R = classifier.predict(testSample.reshape(1, (-1)))[0]
  P = classifier.predict_proba(testSample.reshape(1, (-1)))[0]
 return [R, P]

def classifierWrapper ( classifier , classifierType , testSample ) : R = ( - 1 ) P = ( - 1 ) if ( classifierType == 'knn' ) : [ R , P ] = classifier . classify ( testSample ) elif ( ( classifierType == 'svm' ) or ( classifierType == 'randomforest' ) or ( classifierType == 'gradientboosting' ) or 'extratrees' ) : R = classifier . predict ( testSample . reshape ( 1 , ( - 1 ) ) ) [ 0 ] P = classifier . predict_proba ( testSample . reshape ( 1 , ( - 1 ) ) ) [ 0 ] return [ R , P ]
this function is used as a wrapper to pattern classification .