特征选择有很多方法。最常用的方法之一是贪心算法选择(正向或反向)。具体而言,选择一个特征,在一个固定的评价矩阵上训练一个模型,评价其性能,然后一个一个地往里面增加或移除特征,记录每一步的模型性能。最后选择性能得分最高时的那些特征。
"""
Greedy Feature Selection using Logistic Regression as base model
to optimize Area Under the ROC Curve
"""
import numpy as np
import sklearn.linear_model as lm
from sklearn import metrics, preprocessing
class greedyFeatureSelection(object):
def __init__(self, data, labels, scale=1, verbose=0):
if scale == 1:
self._data = preprocessing.scale(np.array(data))
else:
self._data = np.array(

最低0.47元/天 解锁文章
390

被折叠的 条评论
为什么被折叠?



