吴裕雄 python 机器学习——数据预处理过滤式特征选取VarianceThreshold模型

from sklearn.feature_selection import  VarianceThreshold

#数据预处理过滤式特征选取VarianceThreshold模型
def test_VarianceThreshold():
    X=[[100,1,2,3],
       [100,4,5,6],
       [100,7,8,9],
       [101,11,12,13]]
    selector=VarianceThreshold(1)
    selector.fit(X)
    print("Variances is %s"%selector.variances_)
    print("After transform is %s"%selector.transform(X))
    print("The surport is %s"%selector.get_support(True))
    print("After reverse transform is %s"%selector.inverse_transform(selector.transform(X)))
    
#调用test_VarianceThreshold()
test_VarianceThreshold()

猜你喜欢

转载自www.cnblogs.com/tszr/p/10802018.html