FeatureSelection.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:rdocChallenge 作者: Elyne 项目源码 文件源码
def varianceFilter(train_data, train_classes, threshold):
    #if True:
    #    return frequencyFilter(train_data, train_classes, threshold)
    '''
    Variance filter
    '''
    vectorizer = DictVectorizer()  
    # Fit and transform the train data.        
    x_train = vectorizer.fit_transform(train_data)
    #y_train = train_classes

    sel = VarianceThreshold(threshold=(threshold * (1 - threshold)))
    x_new = sel.fit_transform(x_train)
    return vectorizer.inverse_transform(sel.inverse_transform(x_new))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号