# 需要导入模块: from sklearn import svm [as 别名]
# 或者: from sklearn.svm import predict [as 别名]
def classifier_wrapper(classifier, classifier_type, test_sample):
"""
This function is used as a wrapper to pattern classification.
ARGUMENTS:
- classifier: a classifier object of type sklearn.svm.SVC or
kNN (defined in this library) or sklearn.ensemble.
RandomForestClassifier or sklearn.ensemble.
GradientBoostingClassifier or
sklearn.ensemble.ExtraTreesClassifier
- classifier_type: "svm" or "knn" or "randomforests" or
"gradientboosting" or "extratrees"
- test_sample: a feature vector (np array)
RETURNS:
- R: class ID
- P: probability estimate
EXAMPLE (for some audio signal stored in array x):
import audioFeatureExtraction as aF
import audioTrain