吴裕雄 python 机器学习——数据预处理二元化Binarizer模型

from sklearn.preprocessing import Binarizer

#数据预处理二元化Binarizer模型
def test_Binarizer():
    X=[[1,2,3,4,5],
          [5,4,3,2,1],
          [3,3,3,3,3,],
          [1,1,1,1,1]]
    print("before transform:",X)
    binarizer=Binarizer(threshold=2.5)
    print("after transform:",binarizer.transform(X))

# 调用 test_Binarizer
test_Binarizer() 

猜你喜欢

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