本文整理汇总了Python中sklearn.feature_selection.SelectFdr.transfrom方法的典型用法代码示例。如果您正苦于以下问题:Python SelectFdr.transfrom方法的具体用法?Python SelectFdr.transfrom怎么用?Python SelectFdr.transfrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.feature_selection.SelectFdr
的用法示例。
在下文中一共展示了SelectFdr.transfrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: svm_cv
# 需要导入模块: from sklearn.feature_selection import SelectFdr [as 别名]
# 或者: from sklearn.feature_selection.SelectFdr import transfrom [as 别名]
def svm_cv(data, data_target):
X_train, X_test, y_train, y_test = cross_validation.train_test_split(data, data_target)
print "*" * 79
print "Training..."
# selector = SelectFdr(chi2)
selector = SelectFdr(f_classif)
selector.fit(X_train, y_train)
clf = svm.SVC(kernel='linear', probability=True)
clf.fit(selector.transform(X_train), y_train)
print "Testing..."
pred = clf.predict(selector.transform(X_test))
probs = pred.predict_proba(selector.transfrom(X_test))
accuracy_score = metrics.accuracy_score(y_test, pred)
classification_report = metrics.classification_report(y_test, pred)
support = selector.get_support()
print support
print accuracy_score
print classification_report
precision, recall, thresholds = precision_recall_curve(y_test, probs[:, 1])