本文整理汇总了Python中sklearn.feature_selection.SelectFwe.fit_transform方法的典型用法代码示例。如果您正苦于以下问题:Python SelectFwe.fit_transform方法的具体用法?Python SelectFwe.fit_transform怎么用?Python SelectFwe.fit_transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.feature_selection.SelectFwe
的用法示例。
在下文中一共展示了SelectFwe.fit_transform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SelectFwe
# 需要导入模块: from sklearn.feature_selection import SelectFwe [as 别名]
# 或者: from sklearn.feature_selection.SelectFwe import fit_transform [as 别名]
fs = SelectFwe(alpha=700.0)
print "Before", x_train.shape
clf = svm.LinearSVC(C=100, penalty="l2", dual=False)
clf.fit(x_train, y_train)
print "NO FEATURE SELECTION"
print "Training Accuracy"
print clf.decision_function(x_train)
print (classification_report(y_train, clf.predict(x_train), target_names=target_names))
print "Testing Accuracy"
print (classification_report(y_test, clf.predict(x_test), target_names=target_names))
x_train = fs.fit_transform(x_train, y_train)
print "After", x_train.shape
clf.fit(x_train, y_train)
"""
w = clf.coef_
print w
a = np.array(w[0].todense(), dtype=np.float)
b = np.array(w[1].todense(), dtype=np.float)
c = -100*a/b
print a, b, c
xx = np.linspace(-5, 5)
yy = c * xx - clf.intercept_[0] / b